Reference

GetTimeFormatA(3w)

NAME

GetTimeFormatA (KERNEL32.@)

SYNOPSIS

INT GetTimeFormatA
(
LCID lcid,
DWORD dwFlags,
const SYSTEMTIME* lpTime,
LPCSTR lpFormat,
LPSTR lpTimeStr,
INT cchOut
)

DESCRIPTION

Format a time for a given locale.

PARAMS

lcid [In] Locale to format for.

dwFlags [In] LOCALE_ and TIME_ flags from "winnls.h".

lpTime [In] Time to format.

lpFormat [In] Formatting overrides.

lpTimeStr [Out] Destination for formatted string.

cchOut [In] Size of lpTimeStr, or 0 to calculate the resulting size.

NOTES

- If lpFormat is NULL, lpszValue will be formatted according to the format details returned by GetLocaleInfoA(3w) and modified by dwFlags.

- lpFormat is a string of characters and formatting tokens. Any characters in the string are copied verbatim to lpTimeStr, with tokens being replaced by the time values they represent.

- The following tokens have special meanings in a time format string:

Token Meaning

----- -------

h Hours with no leading zero (12-hour clock)

hh Hours with full two digits (12-hour clock)

H Hours with no leading zero (24-hour clock)

HH Hours with full two digits (24-hour clock)

m Minutes with no leading zero

mm Minutes with full two digits

s Seconds with no leading zero

ss Seconds with full two digits

t Short time marker (e.g. "A" or "P")

tt Long time marker (e.g. "AM", "PM")

- To output any literal character that could be misidentified as a token, enclose it in single quotes.

- The Ascii version of this function fails if lcid is Unicode only.

RETURNS

Success: The number of character written to lpTimeStr, or that would have been written, if cchOut is 0.

Failure: 0. Use GetLastError(3w) to determine the cause.

IMPLEMENTATION

Declared in "winnls.h".

Implemented in "dlls/kernel32/lcformat.c".

Debug channel "nls".

History