Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

Formats the time using the specified formatting options.

Script Syntax

Copy Code
		
strValue = oXTLRuntime.formatTime(
varTime, 
bstrFormat, 
varDestLocale);

Remarks

Script Parameters

varTime

Variant. Time value that is to be formatted.

bstrFormat

String. Specified formatting to be applied to the time. See Remarks.

varDestLocale

[optional] Variant. Locale to use in determining the correct sequence to be employed in the time.

Script Return Value

String. Returns the string containing the time in the requested format.

C/C++ Syntax

Copy Code
HRESULT formatTime(
  VARIANT 
varTime,
  BSTR 
bstrFormat,
  VARIANT 
varDestLocale,
  BSTR* 
pbstrFormattedString
);

Remarks

C/C++ Parameters

varTime

[in] Time value that is to be formatted.

bstrFormat

[in] Formatting to be applied to the time. See Remarks.

varDestLocale

[in, optional] Variant. Locale to use in determining the correct sequence to be employed in the time.

pbstrFormattedString

[out, retval] String containing the time in the requested format.

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 codes that are supported for time formats.

Time format Meaning

h

Hours as 0-23

hh

Hours as 00-23

m

Minutes as 0-59

mm

Minutes as 00-59

s

Seconds as 0-59

ss

Seconds as 00-59

AM/PM

Insert AM or PM, display hours as 12-hour clock

am/pm

Insert am or pm, display hours as 12-hour clock

A/P

Insert A or P, display hours as 12-hour clock

a

Insert a or p, display hours as 12-hour clock

[h]:mm

Elapsed time in hours, for example, 25.02

[mm]:ss

Elapsed time in minutes, for example, 63:46

[ss]

Elapsed time in seconds

ss.00

Fractions of a second

This method applies to the following interface:

IXTLRuntime.