Windows Dev Center

Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DateTimeFormatter.Format(DateTime, String) | format(DateTime, String) method

Returns a string that represents the given date and time in the given time zone, conforming to the template the formatter is currently using.

Syntax


var string = dateTimeFormatter.format(datetime, timeZoneId);

Parameters

datetime

Type: Date [JavaScript] | System.DateTimeOffset [.NET] | Windows::Foundation::DateTime [C++]

The date and time to be formatted.

timeZoneId

Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

An identifier from the IANA Time Zone Database which identifies the time zone that should be used (for example, "Americas/Los_Angeles" for Pacific Time).

Return value

Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

A string that represents the date, time, and time zone.

Requirements (device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Globalization.DateTimeFormatting
Windows::Globalization::DateTimeFormatting [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (operating system)

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.Globalization.DateTimeFormatting
Windows::Globalization::DateTimeFormatting [C++]

Metadata

Windows.winmd

See also

DateTimeFormatter
Format(DateTime)

 

 

Show:
© 2015 Microsoft