---
name: "GetDateFormatA"
section: "3w"
platform: "linux"
package: "libwine-dev"
version: "1.4.1-4"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/GetDateFormatA"
---

# GetDateFormatA(3w)

## NAME

**GetDateFormatA** (KERNEL32.@)

## SYNOPSIS

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

## DESCRIPTION

Format a date for a given locale.

## PARAMS

*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.

## NOTES

**-** If *lpFormat* is **NULL**, *lpDateStr* will be formatted according to the format details returned by **[GetLocaleInfoA(3w)](/GetLocaleInfoA/3w.md)** 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.

## RETURNS

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

**Failure:** **0.** Use **[GetLastError(3w)](/GetLastError/3w.md)** to determine the cause.

## IMPLEMENTATION

Declared in **"winnls.h"**.

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

Debug channel **"nls"**.
