DateTimeFormatter.Format Method

Definition

Overloads

Format(DateTimeOffset)

Returns a string representation of the provided date and time.

Format(DateTimeOffset, String)

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

Format(DateTimeOffset)

Returns a string representation of the provided date and time.

public:
 virtual Platform::String ^ Format(DateTime value) = Format;
winrt::hstring Format(DateTime value);
public string Format(System.DateTimeOffset value);
function format(value)
Public Function Format (value As DateTimeOffset) As String

Parameters

value
DateTimeOffset

The date and time to be formatted.

Returns

String

A string that represents the date and time.

Remarks

Note

If your application supports the Japanese calendar, you should validate that it properly handles the May 2019 Japanese era change. See Prepare your application for the Japanese era change for more information.

See also

Applies to

Format(DateTimeOffset, String)

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

public:
 virtual Platform::String ^ Format(DateTime datetime, Platform::String ^ timeZoneId) = Format;
/// [Windows.Foundation.Metadata.Overload("FormatUsingTimeZone")]
winrt::hstring Format(DateTime datetime, winrt::hstring const & timeZoneId);
[Windows.Foundation.Metadata.Overload("FormatUsingTimeZone")]
public string Format(System.DateTimeOffset datetime, string timeZoneId);
function format(datetime, timeZoneId)
Public Function Format (datetime As DateTimeOffset, timeZoneId As String) As String

Parameters

datetime
DateTimeOffset

The date, time, and timezone to be formatted.

timeZoneId
String

An identifier from the IANA Time Zone Database that identifies the time zone to use (for example, "Americas/Los_Angeles" for Pacific Time).

Returns

String

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

Attributes

Remarks

Note

If your application supports the Japanese calendar, you should validate that it properly handles the May 2019 Japanese era change. See Prepare your application for the Japanese era change for more information.

See also

Applies to