Share via


DateTimeFormatter Constructors

Definition

Overloads

DateTimeFormatter(String)

Creates a DateTimeFormatter object that is initialized by a format template string.

DateTimeFormatter(String, IIterable<String>)

Creates a DateTimeFormatter object that is initialized by a format template string and language list.

DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)

Creates a DateTimeFormatter object that is initialized with hour, minute, and second formats.

DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)

Creates a DateTimeFormatter object that is initialized with year, month, day, and day of week formats.

DateTimeFormatter(String, IIterable<String>, String, String, String)

Creates a DateTimeFormatter object that is initialized by a format template string, language list, geographic region, calendar, and clock.

DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>)

Creates a DateTimeFormatter object that is initialized with year, month, day, day of week, hour, minute, and second formats, and a language list.

DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)

Creates a DateTimeFormatter object with all formats and identifiers specified.

DateTimeFormatter(String)

Creates a DateTimeFormatter object that is initialized by a format template string.

public:
 DateTimeFormatter(Platform::String ^ formatTemplate);
 DateTimeFormatter(winrt::hstring const& formatTemplate);
public DateTimeFormatter(string formatTemplate);
function DateTimeFormatter(formatTemplate)
Public Sub New (formatTemplate As String)

Parameters

formatTemplate
String

Platform::String

winrt::hstring

A format template string that specifies the requested components. The order of the components is irrelevant. This can also be a format pattern. See the remarks for the DateTimeFormatter class for a list of valid format templates and format patterns.

See also

Applies to

DateTimeFormatter(String, IIterable<String>)

Creates a DateTimeFormatter object that is initialized by a format template string and language list.

public:
 DateTimeFormatter(Platform::String ^ formatTemplate, IIterable<Platform::String ^> ^ languages);
 DateTimeFormatter(winrt::hstring const& formatTemplate, IIterable<winrt::hstring> const& languages);
public DateTimeFormatter(string formatTemplate, IEnumerable<string> languages);
function DateTimeFormatter(formatTemplate, languages)
Public Sub New (formatTemplate As String, languages As IEnumerable(Of String))

Parameters

formatTemplate
String

Platform::String

winrt::hstring

A format template string that specifies the requested components. The order of the components is irrelevant. This can also be a format pattern. See the remarks for the DateTimeFormatter class for a list of valid format templates and format patterns.

languages

IIterable<String>

IEnumerable<String>

IIterable<Platform::String>

IIterable<winrt::hstring>

The list of language identifiers, in priority order, that represent the choice of languages. These identifiers are used for resolving the template to a pattern and for formatting. See Remarks.

Remarks

If your app passes language tags used in this class to any National Language Support functions, it must first convert the tags by calling ResolveLocaleName.

Language tags support the Unicode extensions "ca-" and "nu-". (See Unicode Key/Type Definitions.) Note that these extensions can affect the calendar used by Calendar objects.

See also

Applies to

DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)

Creates a DateTimeFormatter object that is initialized with hour, minute, and second formats.

public:
 DateTimeFormatter(HourFormat hourFormat, MinuteFormat minuteFormat, SecondFormat secondFormat);
 DateTimeFormatter(HourFormat const& hourFormat, MinuteFormat const& minuteFormat, SecondFormat const& secondFormat);
public DateTimeFormatter(HourFormat hourFormat, MinuteFormat minuteFormat, SecondFormat secondFormat);
function DateTimeFormatter(hourFormat, minuteFormat, secondFormat)
Public Sub New (hourFormat As HourFormat, minuteFormat As MinuteFormat, secondFormat As SecondFormat)

Parameters

hourFormat
HourFormat

The desired hour format to include in the template.

minuteFormat
MinuteFormat

The desired minute format to include in the template.

secondFormat
SecondFormat

The desired second format to include in the template.

See also

Applies to

DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)

Creates a DateTimeFormatter object that is initialized with year, month, day, and day of week formats.

public:
 DateTimeFormatter(YearFormat yearFormat, MonthFormat monthFormat, DayFormat dayFormat, DayOfWeekFormat dayOfWeekFormat);
 DateTimeFormatter(YearFormat const& yearFormat, MonthFormat const& monthFormat, DayFormat const& dayFormat, DayOfWeekFormat const& dayOfWeekFormat);
public DateTimeFormatter(YearFormat yearFormat, MonthFormat monthFormat, DayFormat dayFormat, DayOfWeekFormat dayOfWeekFormat);
function DateTimeFormatter(yearFormat, monthFormat, dayFormat, dayOfWeekFormat)
Public Sub New (yearFormat As YearFormat, monthFormat As MonthFormat, dayFormat As DayFormat, dayOfWeekFormat As DayOfWeekFormat)

Parameters

yearFormat
YearFormat

The desired year format to include in the template.

monthFormat
MonthFormat

The desired month format to include in the template.

dayFormat
DayFormat

The desired day format to include in the template.

dayOfWeekFormat
DayOfWeekFormat

The desired day of week format to include in the template.

See also

Applies to

DateTimeFormatter(String, IIterable<String>, String, String, String)

Creates a DateTimeFormatter object that is initialized by a format template string, language list, geographic region, calendar, and clock.

public:
 DateTimeFormatter(Platform::String ^ formatTemplate, IIterable<Platform::String ^> ^ languages, Platform::String ^ geographicRegion, Platform::String ^ calendar, Platform::String ^ clock);
 DateTimeFormatter(winrt::hstring const& formatTemplate, IIterable<winrt::hstring> const& languages, winrt::hstring const& geographicRegion, winrt::hstring const& calendar, winrt::hstring const& clock);
public DateTimeFormatter(string formatTemplate, IEnumerable<string> languages, string geographicRegion, string calendar, string clock);
function DateTimeFormatter(formatTemplate, languages, geographicRegion, calendar, clock)
Public Sub New (formatTemplate As String, languages As IEnumerable(Of String), geographicRegion As String, calendar As String, clock As String)

Parameters

formatTemplate
String

Platform::String

winrt::hstring

A format template string that specifies the requested components. The order of the components is irrelevant. This can also be a format pattern. See the remarks for the DateTimeFormatter class for a list of valid format templates and format patterns.

languages

IIterable<String>

IEnumerable<String>

IIterable<Platform::String>

IIterable<winrt::hstring>

The list of language identifiers, in priority order, that represent the choice of languages. These identifiers are used for resolving the template to a pattern, and for formatting. See Remarks.

geographicRegion
String

Platform::String

winrt::hstring

The identifier for the geographic region. This identifier is used for resolving the template to a pattern.

calendar
String

Platform::String

winrt::hstring

The calendar identifier to use.

clock
String

Platform::String

winrt::hstring

The clock identifier to use.

Remarks

If your app passes language tags used in this class to any National Language Support functions, it must first convert the tags by calling ResolveLocaleName.

Language tags support the Unicode extensions "ca-" and "nu-". (See Unicode Key/Type Definitions.) Note that these extensions can affect the calendar used by Calendar objects.

See also

Applies to

DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>)

Creates a DateTimeFormatter object that is initialized with year, month, day, day of week, hour, minute, and second formats, and a language list.

public:
 DateTimeFormatter(YearFormat yearFormat, MonthFormat monthFormat, DayFormat dayFormat, DayOfWeekFormat dayOfWeekFormat, HourFormat hourFormat, MinuteFormat minuteFormat, SecondFormat secondFormat, IIterable<Platform::String ^> ^ languages);
 DateTimeFormatter(YearFormat const& yearFormat, MonthFormat const& monthFormat, DayFormat const& dayFormat, DayOfWeekFormat const& dayOfWeekFormat, HourFormat const& hourFormat, MinuteFormat const& minuteFormat, SecondFormat const& secondFormat, IIterable<winrt::hstring> const& languages);
public DateTimeFormatter(YearFormat yearFormat, MonthFormat monthFormat, DayFormat dayFormat, DayOfWeekFormat dayOfWeekFormat, HourFormat hourFormat, MinuteFormat minuteFormat, SecondFormat secondFormat, IEnumerable<string> languages);
function DateTimeFormatter(yearFormat, monthFormat, dayFormat, dayOfWeekFormat, hourFormat, minuteFormat, secondFormat, languages)
Public Sub New (yearFormat As YearFormat, monthFormat As MonthFormat, dayFormat As DayFormat, dayOfWeekFormat As DayOfWeekFormat, hourFormat As HourFormat, minuteFormat As MinuteFormat, secondFormat As SecondFormat, languages As IEnumerable(Of String))

Parameters

yearFormat
YearFormat

The year format to include in the template.

monthFormat
MonthFormat

The month format to include in the template.

dayFormat
DayFormat

The day format to include in the template.

dayOfWeekFormat
DayOfWeekFormat

The day of week format to include in the template.

hourFormat
HourFormat

The hour format to include in the template.

minuteFormat
MinuteFormat

The minute format to include in the template.

secondFormat
SecondFormat

The second format to include in the template.

languages

IIterable<String>

IEnumerable<String>

IIterable<Platform::String>

IIterable<winrt::hstring>

The list of language identifiers, in priority order, that represent the choice of languages. These identifiers are used for resolving the template to a pattern and for formatting. See Remarks.

Remarks

If your app passes language tags used in this class to any National Language Support functions, it must first convert the tags by calling ResolveLocaleName.

Language tags support the Unicode extensions "ca-" and "nu-". (See Unicode Key/Type Definitions.) Note that these extensions can affect the calendar used by Calendar objects.

See also

Applies to

DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)

Creates a DateTimeFormatter object with all formats and identifiers specified.

public:
 DateTimeFormatter(YearFormat yearFormat, MonthFormat monthFormat, DayFormat dayFormat, DayOfWeekFormat dayOfWeekFormat, HourFormat hourFormat, MinuteFormat minuteFormat, SecondFormat secondFormat, IIterable<Platform::String ^> ^ languages, Platform::String ^ geographicRegion, Platform::String ^ calendar, Platform::String ^ clock);
 DateTimeFormatter(YearFormat const& yearFormat, MonthFormat const& monthFormat, DayFormat const& dayFormat, DayOfWeekFormat const& dayOfWeekFormat, HourFormat const& hourFormat, MinuteFormat const& minuteFormat, SecondFormat const& secondFormat, IIterable<winrt::hstring> const& languages, winrt::hstring const& geographicRegion, winrt::hstring const& calendar, winrt::hstring const& clock);
public DateTimeFormatter(YearFormat yearFormat, MonthFormat monthFormat, DayFormat dayFormat, DayOfWeekFormat dayOfWeekFormat, HourFormat hourFormat, MinuteFormat minuteFormat, SecondFormat secondFormat, IEnumerable<string> languages, string geographicRegion, string calendar, string clock);
function DateTimeFormatter(yearFormat, monthFormat, dayFormat, dayOfWeekFormat, hourFormat, minuteFormat, secondFormat, languages, geographicRegion, calendar, clock)
Public Sub New (yearFormat As YearFormat, monthFormat As MonthFormat, dayFormat As DayFormat, dayOfWeekFormat As DayOfWeekFormat, hourFormat As HourFormat, minuteFormat As MinuteFormat, secondFormat As SecondFormat, languages As IEnumerable(Of String), geographicRegion As String, calendar As String, clock As String)

Parameters

yearFormat
YearFormat

The desired year format to include in the template.

monthFormat
MonthFormat

The desired month format to include in the template.

dayFormat
DayFormat

The desired day format to include in the template.

dayOfWeekFormat
DayOfWeekFormat

The desired day of week format to include in the template.

hourFormat
HourFormat

The desired hour format to include in the template.

minuteFormat
MinuteFormat

The desired minute format to include in the template.

secondFormat
SecondFormat

The desired second format to include in the template.

languages

IIterable<String>

IEnumerable<String>

IIterable<Platform::String>

IIterable<winrt::hstring>

The list of language identifiers, in priority order, that represent the choice of languages. These identifiers are used for resolving the template to a pattern, and for formatting. See Remarks.

geographicRegion
String

Platform::String

winrt::hstring

The identifier for the geographic region. This identifier is used for resolving the template to a pattern.

calendar
String

Platform::String

winrt::hstring

The calendar identifier to use.

clock
String

Platform::String

winrt::hstring

The clock identifier to use.

Remarks

If your app passes language tags used in this class to any National Language Support functions, it must first convert the tags by calling ResolveLocaleName.

Language tags support the Unicode extensions "ca-" and "nu-". (See Unicode Key/Type Definitions.) Note that these extensions can affect the calendar used by Calendar objects.

See also

Applies to