Function Reference


_DateTimeFormat

Returns the date in the PC's regional settings format

#include <Date.au3>
_DateTimeFormat ( $sDate, $sType )

Parameters

$sDate Input date in the format "YYYY/MM/DD[ HH:MM:SS]"
$sType one the following:
0 - Display a date and/or time. If there is a date part, display it as a short date.
If there is a time part, display it as a long time. If present, both parts are displayed.
1 - Display a date using the long date format specified in your computer's regional settings.
2 - Display a date using the short date format specified in your computer's regional settings.
3 - Display a time using the time format specified in your computer's regional settings.
4 - Display a time using the 24-hour format (hh:mm).
5 - Display a time using the 24-hour format (hh:mm:ss).

Return Value

Success: the date in proper format.
Failure: 0 and set the @error flag to non-zero.
@error: 1 - Invalid $sDate
2 - Invalid $sType

Remarks

See _DateTimeSplit() for other possible variations of the input date format.

Related

_NowDate, _NowTime

Example

#include <Date.au3>
#include <MsgBoxConstants.au3>

; Show current date/time in the pc's format
MsgBox($MB_SYSTEMMODAL, "Pc Long format", _DateTimeFormat(_NowCalc(), 1))
MsgBox($MB_SYSTEMMODAL, "Pc Short format", _DateTimeFormat(_NowCalc(), 2))