Partager via


formatDate Method (Compact 2013)

3/26/2014

Formats the date using the specified formatting options.

Syntax

strValue = oXTLRuntime.formatDate(varDate, bstrFormat, varDestLocale);
HRESULT formatDate(
  VARIANT varDate,
  BSTR bstrFormat,
  VARIANT varDestLocale,
  BSTR* pbstrFormattedString
);

Parameters

Script

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

C/C++

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

Return Value

Script

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 this Microsoft Web site.

C/C++

  • S_OK
    Value returned if successful.

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:

IXTLRuntime.

Requirements

Header

msxml2.h,
msxml2.idl

Library

uuid.lib

See Also

Reference

XSLT Methods