DateTimeFormatter.Format DateTimeFormatter.Format DateTimeFormatter.Format DateTimeFormatter.Format DateTimeFormatter.Format Method

Definition

Overloads

Format(DateTime) Format(DateTime) Format(DateTime) Format(DateTime) Format(DateTime)

Returns a string representation of the provided date and time.

Format(DateTime, String) Format(DateTime, String) Format(DateTime, String) Format(DateTime, String) Format(DateTime, 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(DateTime) Format(DateTime) Format(DateTime) Format(DateTime) Format(DateTime)

Returns a string representation of the provided date and time.

public : Platform::String Format(DateTime value)
winrt::hstring Format(DateTime value) const;
public string Format(DateTimeOffset value)
Public Function Format(value As DateTimeOffset) As string
var string = dateTimeFormatter.format(value);

Parameters

value
DateTimeOffset DateTimeOffset DateTimeOffset

The DateTime to be formatted.

Returns

string string string

A string that represents the date and time.

Remarks

Note

This API is being updated to support the May 2019 Japanese era change. If your application supports the Japanese calendar, you should validate that it properly handles the new era. See Prepare your application for the Japanese era change for more information.

See also

Format(DateTime, String) Format(DateTime, String) Format(DateTime, String) Format(DateTime, String) Format(DateTime, 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 : Platform::String Format(DateTime datetime, Platform::String timeZoneId)
winrt::hstring Format(DateTime datetime, winrt::hstring timeZoneId) const;
public string Format(DateTimeOffset datetime, String timeZoneId)
Public Function Format(datetime As DateTimeOffset, timeZoneId As String) As string
var string = dateTimeFormatter.format(datetime, timeZoneId);

Parameters

datetime
DateTimeOffset DateTimeOffset DateTimeOffset

The DateTime to be formatted.

timeZoneId
String String 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 string string

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

Remarks

Note

This API is being updated to support the May 2019 Japanese era change. If your application supports the Japanese calendar, you should validate that it properly handles the new era. See Prepare your application for the Japanese era change for more information.

See also