Scroll to navigation

GetDateFormatA(3w) Wine API GetDateFormatA(3w)


GetDateFormatA (KERNEL32.@)


INT GetDateFormatA
LCID lcid,
DWORD dwFlags,
const SYSTEMTIME* lpTime,
LPCSTR lpFormat,
LPSTR lpDateStr,
INT cchOut


Format a date for a given locale.


lcid [In] Locale to format for.
dwFlags [In] LOCALE_ and DATE_ flags from "winnls.h".
lpTime [In] Date to format.
lpFormat [In] Format string, or NULL to use the system defaults.
lpDateStr [Out] Destination for formatted string.
cchOut [In] Size of lpDateStr, or 0 to calculate the resulting size.


- If lpFormat is NULL, lpDateStr 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 lpDateStr, with tokens being replaced by the date values they represent.
- The following tokens have special meanings in a date format string:

Token Meaning

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

d Single digit day of the month (no leading 0)

dd Double digit day of the month

ddd Short name for the day of the week

dddd Long name for the day of the week

M Single digit month of the year (no leading 0)

MM Double digit month of the year

MMM Short name for the month of the year

MMMM Long name for the month of the year

y Double digit year number (no leading 0)

yy Double digit year number

yyyy Four digit year number

gg Era string, for example 'AD'.
- 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.


Success: The number of character written to lpDateStr, or that would have been written, if cchOut is 0.
Failure: 0. Use GetLastError(3w) to determine the cause.


Declared in "winnls.h".
Implemented in "dlls/kernel32/lcformat.c".
Debug channel "nls".
Oct 2012 Wine API