Function Reference


_WinAPI_GetDateFormat

Formats a date as a date string for a locale specified by the locale identifier

#include <WinAPILocale.au3>
_WinAPI_GetDateFormat ( [$iLCID = 0 [, $tSYSTEMTIME = 0 [, $iFlags = 0 [, $sFormat = '']]]] )

Parameters

$iLCID [optional] The locale identifier (LCID) that specifies the locale or one of the following predefined values.
    $LOCALE_INVARIANT
    $LOCALE_SYSTEM_DEFAULT
    $LOCALE_USER_DEFAULT (Default)
Windows Vista or later
    $LOCALE_CUSTOM_DEFAULT
    $LOCALE_CUSTOM_UI_DEFAULT
    $LOCALE_CUSTOM_UNSPECIFIED
$tSYSTEMTIME [optional] $tagSYSTEMTIME structure that contains the date information to format.
If this parameter is 0 (Default), the function will use the current local system date.
$iFlags [optional] The flags that specifies the date format options.
This parameter can be one or more of the following values:
    $DATE_LONGDATE
    $DATE_SHORTDATE (Default)
    $DATE_USE_ALT_CALENDAR
Windows Vista or later
    $DATE_LTRREADING
    $DATE_RTLREADING
    $DATE_YEARMONTH
Windows 7 or later
    $DATE_AUTOLAYOUT
$sFormat [optional] The string that is used to form the date. For example, "dddd MMMM, yyyy".
If this parameter is omitted or an empty string (Default), the function returns the string according to the date format for the specified locale.

Return Value

Success: The formatted date string.
Failure: Empty string, call _WinAPI_GetLastError() to get extended error information.

See Also

Search GetDateFormat in MSDN Library.

Example

#include <APILocaleConstants.au3>
#include <WinAPILocale.au3>

ConsoleWrite(_WinAPI_GetDateFormat() & @CRLF)
ConsoleWrite(_WinAPI_GetDateFormat(0, 0, $DATE_LONGDATE) & @CRLF)
ConsoleWrite(_WinAPI_GetDateFormat(0, 0, 0, 'dddd dd, yyyy') & @CRLF)