formatDate Method
A version of this page is also available for
4/8/2010
Formats the date using the specified formatting options.
Script Syntax
strValue = oXTLRuntime.formatDate(varDate, bstrFormat, varDestLocale);
Remarks
Script Parameters
- varDate
Variant. Date that is to be formatted.
- bstrFormat
String. Specified formatting. See Remarks.
[optional] Variant. Locale to use in determining the correct sequence to be employed in the date. If not supplied, the month-day-year sequence is used.
Script Return Value
String. Returns the string containing the date in the requested format.
The formatDate method is derived from the Win32 application programming interface (API) call, GetDateFormat. Information about this API can be found at GetDateFormat in the Win32 section of the MSDN Library.
C/C++ Syntax
HRESULT formatDate(
VARIANT varDate,
BSTR bstrFormat,
VARIANT varDestLocale,
BSTR* pbstrFormattedString
);
Remarks
C/C++ Parameters
- varDate
[in] Date that is to be formatted.
- bstrFormat
[in] Formatting specifics. See Remarks.
varDestLocale
[in, optional] Variant. Locale to use in determining the correct sequence to be employed in the date. If not supplied, the month-day-year sequence is used.Note
This parameter is not yet implemented.
- pbstrFormattedString
[out, retval] String containing the date in the requested format.
C/C++ Return Values
- S_OK
Value returned if successful.
Requirements
Header | msxml2.h, msxml2.idl |
Library | uuid.lib |
Windows Embedded CE | Windows CE .NET 4.0 and later |
General Remarks
The following table shows the supported date codes.
Date format | Meaning |
---|---|
M |
Months as 1–12 |
MM |
Months as 01–12 |
MMM |
Months as Jan–Dec |
MMMM |
Months as January–December |
MMMMM |
Months as the first letter of the month |
d |
Days as 1–31 |
dd |
Days as 01–31 |
ddd |
Days as Sun–Sat |
dddd |
Days as Sunday–Saturday |
yy |
Years as 00–99 |
yyyy |
Years as 1900–9999 |
This method applies to the following interface: