DateTimeFormatter
DateTimeFormatter
DateTimeFormatter
DateTimeFormatter
Class
Definition
Formats dates and times.
public : sealed class DateTimeFormatter : IDateTimeFormatter, IDateTimeFormatter2public sealed class DateTimeFormatter : IDateTimeFormatter, IDateTimeFormatter2Public NotInheritable Class DateTimeFormatter Implements IDateTimeFormatter, IDateTimeFormatter2// You can use this class in JavaScript.
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Examples
Use the DateTimeFormatter class to format a date.
// Format a date via a string template. Note that the order specifed in the string pattern does
// not determine the order of the parts of the formatted string. The user's language and region
// preferences will determine the pattern of the date returned based on the specified parts.
var mydatefmt = new Windows.Globalization.DateTimeFormatting.DateTimeFormatter("month day dayofweek year");
var dateToFormat = new Date();
var mydate = mydatefmt.format(dateToFormat);
// Format a date via a string template. Note that the order specifed in the string pattern does
// not determine the order of the parts of the formatted string. The user's language and region
// preferences will determine the pattern of the date returned based on the specified parts.
var formatter = new Windows.Globalization.DateTimeFormatting.DateTimeFormatter("month day dayofweek year");
DateTime dateToFormat = DateTime.Now;
var mydate = formatter.Format(dateToFormat);
Pattern grammarThe following grammar defines what is accepted for a pattern:
<pattern> ::= [<literal-text>] <datetime-pattern> [<literal-text>] |
[<literal-text>] <datetime-pattern> <pattern>
<literal-text> ::= <literal-character>+
<literal-character> ::= [^{}] | "{openbrace}" | "{closebrace}"
<datetime-pattern> ::= <date-pattern> | <time-pattern>
<date-pattern> ::= <era> | <year> | <month> | <day> | <dayofweek>
<time-pattern> ::= <period> | <hour> | <minute> | <second> | <timezone>
<era> ::= "{era.abbreviated" [<ideal-length>] "}"
<year> ::= "{year.full" [<ideal-length>] "}" |
"{year.abbreviated" [<ideal-length>] "}"
<month> ::= "{month.full}" |
"{month.solo.full}" |
"{month.abbreviated" [<ideal-length>] "}"
"{month.solo.abbreviated" [<ideal-length>] "}"
"{month.integer" [<ideal-length>] "}"
<dayofweek> ::= "{dayofweek.full}" |
"{dayofweek.solo.full}" |
"{dayofweek.abbreviated" [<ideal-length>] "}"
"{dayofweek.solo.abbreviated" [<ideal-length>] "}"
<day> ::= "{day.integer" [<ideal-length>] "}"
<period> ::= "{period.abbreviated" [<ideal-length>] "}"
<hour> ::= "{hour.integer" [<ideal-length>] "}"
<minute> ::= "{minute.integer" [<ideal-length>] "}"
<second> ::= "{second.integer" [<ideal-length>] "}"
<timezone> ::= "{timezone.full}" |
"{timezone.abbreviated" [<ideal-length>] "}"
<ideal-length> ::= "(" <non-zero-digit> ")"
<non-zero-digit> ::= "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
Template grammarThe following grammar defines what is accepted for a template:
<template> ::= <opt-whitespace> <date> <opt-whitespace> |
<opt-whitespace> <time> <opt-whitespace> |
<opt-whitespace> <specific-date> <whitespace> <time> <opt-whitespace> |
<opt-whitespace> <time> <whitespace> <specific-date> <opt-whitespace> |
<opt-whitespace> <relative-date> <whitespace> <time> <opt-whitespace> |
<opt-whitespace> <time> <whitespace> <relative-date> <opt-whitespace>
<opt-whitespace> ::= [<whitespace>]
<whitespace> ::= " "+
<date> ::= <year> | <month> | <day> | <month-year> | <relative-date> | <specific-date>
<relativedate> ::= <dayofweek> | <month-day> | <relative-longdate>
<specificdate> ::= <shortdate> | <longdate>
<month-day> ::= <month> <whitespace> <day> |
<day> <whitespace> <month>
<relative-longdate> ::= <month> <whitespace> <day> <whitespace> <dayofweek> |
<month> <whitespace> <dayofweek> <whitespace> <day> |
<day> <whitespace> <month> <whitespace> <dayofweek> |
<day> <whitespace> <dayofweek> <whitespace> <month> |
<dayofweek> <whitespace> <day> <whitespace> <month> |
<dayofweek> <whitespace> <month> <whitespace> <day>
<month-year> ::= <month> <whitespace> <year> |
<year> <whitespace> <month>
<shortdate> ::= "shortdate" |
<month> <whitespace> <day> <whitespace> <year> |
<month> <whitespace> <year> <whitespace> <day> |
<day> <whitespace> <month> <whitespace> <year> |
<day> <whitespace> <year> <whitespace> <month> |
<year> <whitespace> <day> <whitespace> <month> |
<year> <whitespace> <month> <whitespace> <day>
<longdate> ::= "longdate" |
<year> <whitespace> <month> <whitespace> <day> <whitespace> <dayofweek> |
<year> <whitespace> <month> <whitespace> <dayofweek> <whitespace> <day> |
<year> <whitespace> <day> <whitespace> <month> <whitespace> <dayofweek> |
<year> <whitespace> <day> <whitespace> <dayofweek> <whitespace> <month> |
<year> <whitespace> <dayofweek> <whitespace> <day> <whitespace> <month> |
<year> <whitespace> <dayofweek> <whitespace> <month> <whitespace> <day> |
<month> <whitespace> <year> <whitespace> <day> <whitespace> <dayofweek> |
<month> <whitespace> <year> <whitespace> <dayofweek> <whitespace> <day> |
<day> <whitespace> <year> <whitespace> <month> <whitespace> <dayofweek> |
<day> <whitespace> <year> <whitespace> <dayofweek> <whitespace> <month> |
<dayofweek> <whitespace> <year> <whitespace> <day> <whitespace> <month> |
<dayofweek> <whitespace> <year> <whitespace> <month> <whitespace> <day> |
<month> <whitespace> <day> <whitespace> <year> <whitespace> <dayofweek> |
<month> <whitespace> <dayofweek> <whitespace> <year> <whitespace> <day> |
<day> <whitespace> <month> <whitespace> <year> <whitespace> <dayofweek> |
<day> <whitespace> <dayofweek> <whitespace> <year> <whitespace> <month> |
<dayofweek> <whitespace> <day> <whitespace> <year> <whitespace> <month> |
<dayofweek> <whitespace> <month> <whitespace> <year> <whitespace> <day> |
<month> <whitespace> <day> <whitespace> <dayofweek> <whitespace> <year> |
<month> <whitespace> <dayofweek> <whitespace> <day> <whitespace> <year> |
<day> <whitespace> <month> <whitespace> <dayofweek> <whitespace> <year> |
<day> <whitespace> <dayofweek> <whitespace> <month> <whitespace> <year> |
<dayofweek> <whitespace> <day> <whitespace> <month> <whitespace> <year> |
<dayofweek> <whitespace> <month> <whitespace> <day> <whitespace> <year>
<time> ::= <hour> |
<hour> <whitespace> <timezone> |
<timezone> <whitespace> <hour> |
<shorttime> |
<longtime>
<shorttime> ::= "shorttime" |
<hour> <whitespace> <minute> |
<minute> <whitespace> <hour> |
<timezone> <whitespace> <hour> <whitespace> <minute> |
<timezone> <whitespace> <minute> <whitespace> <hour> |
<hour> <whitespace> <timezone> <whitespace> <minute> |
<minute> <whitespace> <timezone> <whitespace> <hour> |
<hour> <whitespace> <minute> <whitespace> <timezone> |
<minute> <whitespace> <hour> <whitespace> <timezone>
<longtime> ::= "longtime" |
<hour> <whitespace> <minute> <whitespace> <second> |
<hour> <whitespace> <second> <whitespace> <minute> |
<minute> <whitespace> <hour> <whitespace> <second> |
<minute> <whitespace> <second> <whitespace> <hour> |
<second> <whitespace> <minute> <whitespace> <hour> |
<second> <whitespace> <hour> <whitespace> <minute> |
<timezone> <whitespace> <hour> <whitespace> <minute> <whitespace> <second> |
<timezone> <whitespace> <hour> <whitespace> <second> <whitespace> <minute> |
<timezone> <whitespace> <minute> <whitespace> <hour> <whitespace> <second> |
<timezone> <whitespace> <minute> <whitespace> <second> <whitespace> <hour> |
<timezone> <whitespace> <second> <whitespace> <minute> <whitespace> <hour> |
<timezone> <whitespace> <second> <whitespace> <hour> <whitespace> <minute> |
<hour> <whitespace> <timezone> <whitespace> <minute> <whitespace> <second> |
<hour> <whitespace> <timezone> <whitespace> <second> <whitespace> <minute> |
<minute> <whitespace> <timezone> <whitespace> <hour> <whitespace> <second> |
<minute> <whitespace> <timezone> <whitespace> <second> <whitespace> <hour> |
<second> <whitespace> <timezone> <whitespace> <minute> <whitespace> <hour> |
<second> <whitespace> <timezone> <whitespace> <hour> <whitespace> <minute> |
<hour> <whitespace> <minute> <whitespace> <timezone> <whitespace> <second> |
<hour> <whitespace> <second> <whitespace> <timezone> <whitespace> <minute> |
<minute> <whitespace> <hour> <whitespace> <timezone> <whitespace> <second> |
<minute> <whitespace> <second> <whitespace> <timezone> <whitespace> <hour> |
<second> <whitespace> <minute> <whitespace> <timezone> <whitespace> <hour> |
<second> <whitespace> <hour> <whitespace> <timezone> <whitespace> <minute> |
<hour> <whitespace> <minute> <whitespace> <second> <whitespace> <timezone> |
<hour> <whitespace> <second> <whitespace> <minute> <whitespace> <timezone> |
<minute> <whitespace> <hour> <whitespace> <second> <whitespace> <timezone> |
<minute> <whitespace> <second> <whitespace> <hour> <whitespace> <timezone> |
<second> <whitespace> <minute> <whitespace> <hour> <whitespace> <timezone> |
<second> <whitespace> <hour> <whitespace> <minute> <whitespace> <timezone>
<year> ::= "year" | "year.full" | "year.abbreviated"
<month> ::= "month" | "month.full" | "month.abbreviated" | "month.numeric"
<day> ::= "day"
<dayofweek> ::= "dayofweek" | "dayofweek.full" | "dayofweek.abbreviated"
<hour> ::= "hour"
<minute> ::= "minute"
<second> ::= "second"
<timezone> ::= "timezone" | "timezone.full" | "timezone.abbreviated"
Remarks
Note
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.
Some of the constructors for DateTimeFormatter take a formatTemplate string parameter that specifies the requested components to be formatted. This parameter can be either a format template or a format pattern. Format templates are convenient to use and provide formatting which is typical for the language, clock and calendar that you specify. Format patterns provide greater control of output than format templates. If you need formatting that is non-standard, use format patterns instead of templates.
In a format template, you specify the components (time, date, day of week, etc.) that you want to include in the formatted output. The formatter formats the components as appropriate for the specified language, clock and calendar. The order of the components in your template does not matter; the formatter orders the components according to the order shown in the format template language below.
Some commonly-used templates are listed in the following table. In templates with more than one component, the component may be any of the supported component variations and the components may be in any order. For example, "dayofweek.full year month.numeric day" is supported. (See below, after the Examples, for the grammar that defines valid templates.)
Important
You can't arbitrarily combine components and necessarily obtain a valid template. The only valid templates are those defined by the provided grammar.
| Template |
|---|
| longdate |
| shortdate |
| longtime |
| shorttime |
| dayofweek |
| dayofweek.full |
| dayofweek.abbreviated |
| day |
| month |
| month.full |
| month.abbreviated |
| month.numeric |
| year |
| year.full |
| year.abbreviated |
| dayofweek day month year |
| dayofweek day month |
| day month year |
| day month |
| month year |
| hour |
| minute |
| second |
| hour minute second |
| hour minute |
| timezone |
| timezone.full |
| timezone.abbreviated |
| year month day hour |
The following table shows sample output from formatters created with various values of template, language, and clock. The "Equivalent pattern" column provides a pattern that produces the same output as the template.
| Template | Language | Clock | Output | Equivalent pattern |
|---|---|---|---|---|
| longdate | en-US | <not specified> | Monday, September 2, 2013 | {dayofweek.full}, {month.full} {day.integer}, {year.full} |
| longdate | fr-FR | <not specified> | lundi 2 septembre 2013 | {dayofweek.full} {day.integer} {month.full} {year.full} |
| shortdate | en-US | <not specified> | 9/2/2013 | {month.integer}/{day.integer}/{year.full} |
| shortdate | fr-FR | <not specified> | 02/09/2013 | {day.integer(2)}/{month.integer(2)}/{year.full} |
| dayofweek month day | en-US | <not specified> | Monday, September 2 | {dayofweek.full}, {month.full} {day.integer} |
| month day dayofweek | en-US | <not specified> | Monday, September 2 | {dayofweek.full}, {month.full} {day.integer} |
| longtime | en-US | <not specified> | 6:01:24 AM | {hour.integer}:{minute.integer(2)}:{second.integer(2)} {period.abbreviated} |
| longtime | en-US | 24HourClock | 17:32:45 | {hour.integer}:{minute.integer(2)}:{second.integer(2)} |
| longtime | fr-FR | <not specified> | 17:32:45 | {hour.integer(2)}:{minute.integer(2)}:{second.integer(2)} |
| shorttime | en-US | <not specified> | 6:01 AM | {hour.integer}:{minute.integer(2)} {period.abbreviated} |
| shorttime | en-US | 24HourClock | 17:32 | {hour.integer}:{minute.integer(2)} |
| shorttime | fr-FR | <not specified> | 17:32 | {hour.integer(2)}:{minute.integer(2)} |
Format patterns are composed of a literal string with fields delimited by braces, such as "{day.numeric}/{month.numeric}/{year.full}". Some commonly-used fields are listed in the following table. (See below, after the Examples, for the grammar that defines valid patterns.)
Important
You can't arbitrarily combine fields and necessarily obtain a valid pattern. The only valid patterns are those defined by the provided grammar.
| Format pattern field |
|---|
| {openbrace} |
| {closebrace} |
| {dayofweek.solo.<type>} where <type> is full / abbreviated / abbreviated(n) |
| {dayofweek.<type>} where <type> is full / abbreviated / abbreviated(n) |
| {day.<type>} where <type> is integer / integer(n) |
| {month.<type>} where <type> is full / abbreviated / abbreviated(n) / integer / integer(n) |
| {month.solo.<type>} where <type> is full / abbreviated / abbreviated(n) |
| {year.<type>} where <type> is full / abbreviated / abbreviated(n) |
| {era.<type>} where <type> is full / abbreviated / abbreviated(n) |
| {hour.<type>} where <type> is integer / integer(n) |
| {period.<type>} where <type> is full / abbreviated / abbreviated(n) |
| {minute.<type>} where <type> is integer / integer(n) |
| {second.<type>} where <type> is integer / integer(n) |
| {timezone.<type>} where <type> is full / abbreviated / abbreviated(n) |
Note
- Use {openbrace} or {closebrace} to specify that "{" or "}" appears as part of the literal string.
- solo specifies the standalone form. For languages with genitive case distinctions, the genitive case is the unmarked case. To get the nominative case, use solo.
- integer(2) for the fifth day of the month (for example) is "05", while integer(1) produces "5". integer produces the best n for a given language/calendar combination.
- For years, full produces all digits ("2013"). abbreviated is synonymous with abbreviated(2), which is the 2-digit year for the gregorian calendar ("13"). (Other calendars may eventually use something else as the default; we have kept abbreviated to have the semantics of the best for a given language/calendar combination.) abbreviated(n) is truncated to the least significant n digits (for example, 2013 with n =1 is "3").
The following table shows sample output from formatters created with various values of pattern, language, and clock.
| Pattern | Language | Clock | Output |
|---|---|---|---|
| {dayofweek.full}, {month.full} {day.integer}, {year.full} | en-US | <not specified> | Monday, September 2, 2013 |
| {dayofweek.full}, {day.integer(2)} {month.full}, {year.full} | fr-FR | <not specified> | lundi, 02 septembre, 2013 |
| {month.integer}/{day.integer}/{year.full} | en-US | <not specified> | 9/2/2013 |
| {month.integer}/{day.integer}/{year.abbreviated} | en-US | <not specified> | 9/2/13 |
| {month.integer(2)}/{day.integer(2)}/{year.abbreviated} | en-US | <not specified> | 09/02/13 |
| {hour.integer}:{minute.integer(2)}:{second.integer(2)} {period.abbreviated} | en-US | <not specified> | 6:01:24 AM |
| {hour.integer}:{minute.integer(2)}:{second.integer(2)} {period.abbreviated} | en-US | 24HourClock | 17:32:45 |
Constructors
DateTimeFormatter(String) DateTimeFormatter(String) DateTimeFormatter(String) DateTimeFormatter(String)
Creates a DateTimeFormatter object that is initialized by a format template string.
public : DateTimeFormatter(PlatForm::String formatTemplate)public DateTimeFormatter(String formatTemplate)Public Sub New(formatTemplate As String)// You can use this method in JavaScript.
- formatTemplate
- PlatForm::String String String String
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
-
DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)
DateTimeFormatter(String, IIterable)
DateTimeFormatter(String, IIterable)
DateTimeFormatter(String, IIterable)
DateTimeFormatter(String, IIterable)
Creates a DateTimeFormatter object that is initialized by a format template string and language list.
public : DateTimeFormatter(PlatForm::String formatTemplate, IIterable<PlatForm::String> languages)public DateTimeFormatter(String formatTemplate, IEnumerable<String> languages)Public Sub New(formatTemplate As String, languages As IEnumerable<String>)// You can use this method in JavaScript.
- formatTemplate
- PlatForm::String String String String
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<PlatForm::String> IEnumerable<String> IEnumerable<String> IEnumerable<String>
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.
Starting in : Language tags support the Unicode extensions "ca-" and "nu-". (See Unicode Key/Type Definitions.) Note that the "ca-" extension can affect the calendar used by DateTimeFormatter objects.
- See Also
-
DateTimeFormatter(String)DateTimeFormatter(String)DateTimeFormatter(String)DateTimeFormatter(String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)
DateTimeFormatter(String, IIterable, String, String, String)
DateTimeFormatter(String, IIterable, String, String, String)
DateTimeFormatter(String, IIterable, String, String, String)
DateTimeFormatter(String, IIterable, 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)public DateTimeFormatter(String formatTemplate, IEnumerable<String> languages, String geographicRegion, String calendar, String clock)Public Sub New(formatTemplate As String, languages As IEnumerable<String>, geographicRegion As String, calendar As String, clock As String)// You can use this method in JavaScript.
- formatTemplate
- PlatForm::String String String String
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<PlatForm::String> IEnumerable<String> IEnumerable<String> IEnumerable<String>
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
- PlatForm::String String String String
The identifier for the geographic region. This identifier is used for resolving the template to a pattern.
- calendar
- PlatForm::String String String String
The calendar identifier to use.
- clock
- PlatForm::String String String String
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.
Starting in : Language tags support the Unicode extensions "ca-" and "nu-". (See Unicode Key/Type Definitions.) Note that the "ca-" extension can affect the calendar used by DateTimeFormatter objects.
- See Also
-
DateTimeFormatter(String)DateTimeFormatter(String)DateTimeFormatter(String)DateTimeFormatter(String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)
DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat) DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat) DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat) 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)public DateTimeFormatter(HourFormat hourFormat, MinuteFormat minuteFormat, SecondFormat secondFormat)Public Sub New(hourFormat As HourFormat, minuteFormat As MinuteFormat, secondFormat As SecondFormat)// You can use this method in JavaScript.
- hourFormat
- HourFormat HourFormat HourFormat HourFormat
The desired hour format to include in the template.
- minuteFormat
- MinuteFormat MinuteFormat MinuteFormat MinuteFormat
The desired minute format to include in the template.
- secondFormat
- SecondFormat SecondFormat SecondFormat SecondFormat
The desired second format to include in the template.
- See Also
-
DateTimeFormatter(String)DateTimeFormatter(String)DateTimeFormatter(String)DateTimeFormatter(String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)
DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat) DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat) DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat) 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)public DateTimeFormatter(YearFormat yearFormat, MonthFormat monthFormat, DayFormat dayFormat, DayOfWeekFormat dayOfWeekFormat)Public Sub New(yearFormat As YearFormat, monthFormat As MonthFormat, dayFormat As DayFormat, dayOfWeekFormat As DayOfWeekFormat)// You can use this method in JavaScript.
- yearFormat
- YearFormat YearFormat YearFormat YearFormat
The desired year format to include in the template.
- monthFormat
- MonthFormat MonthFormat MonthFormat MonthFormat
The desired month format to include in the template.
The desired day format to include in the template.
- dayOfWeekFormat
- DayOfWeekFormat DayOfWeekFormat DayOfWeekFormat DayOfWeekFormat
The desired day of week format to include in the template.
- See Also
-
DateTimeFormatter(String)DateTimeFormatter(String)DateTimeFormatter(String)DateTimeFormatter(String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)
DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable)
DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable)
DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable)
DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable)
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)public DateTimeFormatter(YearFormat yearFormat, MonthFormat monthFormat, DayFormat dayFormat, DayOfWeekFormat dayOfWeekFormat, HourFormat hourFormat, MinuteFormat minuteFormat, SecondFormat secondFormat, IEnumerable<String> 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<String>)// You can use this method in JavaScript.
- yearFormat
- YearFormat YearFormat YearFormat YearFormat
The year format to include in the template.
- monthFormat
- MonthFormat MonthFormat MonthFormat MonthFormat
The month format to include in the template.
- dayOfWeekFormat
- DayOfWeekFormat DayOfWeekFormat DayOfWeekFormat DayOfWeekFormat
The day of week format to include in the template.
- hourFormat
- HourFormat HourFormat HourFormat HourFormat
The hour format to include in the template.
- minuteFormat
- MinuteFormat MinuteFormat MinuteFormat MinuteFormat
The minute format to include in the template.
- secondFormat
- SecondFormat SecondFormat SecondFormat SecondFormat
The second format to include in the template.
- languages
- IIterable<PlatForm::String> IEnumerable<String> IEnumerable<String> IEnumerable<String>
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.
Starting in : Language tags support the Unicode extensions "ca-" and "nu-". (See Unicode Key/Type Definitions.) Note that the "ca-" extension can affect the calendar used by DateTimeFormatter objects.
- See Also
-
DateTimeFormatter(String)DateTimeFormatter(String)DateTimeFormatter(String)DateTimeFormatter(String)DateTimeFormatter(String, IIterable<String>)DateTimeFormatter(String, IIterable<String>)DateTimeFormatter(String, IIterable<String>)DateTimeFormatter(String, IIterable<String>)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)DateTimeFormatter(HourFormat, MinuteFormat, SecondFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable<String>, String, String, String)
DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable, String, String, String)
DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable, String, String, String)
DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable, String, String, String)
DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat, HourFormat, MinuteFormat, SecondFormat, IIterable, 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)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)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<String>, geographicRegion As String, calendar As String, clock As String)// You can use this method in JavaScript.
- yearFormat
- YearFormat YearFormat YearFormat YearFormat
The desired year format to include in the template.
- monthFormat
- MonthFormat MonthFormat MonthFormat MonthFormat
The desired month format to include in the template.
The desired day format to include in the template.
- dayOfWeekFormat
- DayOfWeekFormat DayOfWeekFormat DayOfWeekFormat DayOfWeekFormat
The desired day of week format to include in the template.
- hourFormat
- HourFormat HourFormat HourFormat HourFormat
The desired hour format to include in the template.
- minuteFormat
- MinuteFormat MinuteFormat MinuteFormat MinuteFormat
The desired minute format to include in the template.
- secondFormat
- SecondFormat SecondFormat SecondFormat SecondFormat
The desired second format to include in the template.
- languages
- IIterable<PlatForm::String> IEnumerable<String> IEnumerable<String> IEnumerable<String>
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
- PlatForm::String String String String
The identifier for the geographic region. This identifier is used for resolving the template to a pattern.
- calendar
- PlatForm::String String String String
The calendar identifier to use.
- clock
- PlatForm::String String String String
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.
Starting in : Language tags support the Unicode extensions "ca-" and "nu-". (See Unicode Key/Type Definitions.) Note that the "ca-" extension can affect the calendar used by DateTimeFormatter objects.
- See Also
-
DateTimeFormatter(String)DateTimeFormatter(String)DateTimeFormatter(String)DateTimeFormatter(String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(String, IIterable<String>, String, String, String)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)DateTimeFormatter(YearFormat, MonthFormat, DayFormat, DayOfWeekFormat)
Properties
Calendar Calendar Calendar Calendar
Gets the calendar that is used when formatting dates.
public : PlatForm::String Calendar { get; }public string Calendar { get; }Public ReadOnly Property Calendar As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The calendar that is used.
Clock Clock Clock Clock
Gets the clock that is used when formatting times.
public : PlatForm::String Clock { get; }public string Clock { get; }Public ReadOnly Property Clock As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The clock that is used.
GeographicRegion GeographicRegion GeographicRegion GeographicRegion
Gets or sets the region that is used when formatting dates and times.
public : PlatForm::String GeographicRegion { get; }public string GeographicRegion { get; }Public ReadOnly Property GeographicRegion As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The region that is used.
IncludeDay IncludeDay IncludeDay IncludeDay
Gets the DayFormat in the template.
public : DayFormat IncludeDay { get; }public DayFormat IncludeDay { get; }Public ReadOnly Property IncludeDay As DayFormat// You can use this property in JavaScript.
IncludeDayOfWeek IncludeDayOfWeek IncludeDayOfWeek IncludeDayOfWeek
Gets the DayOfWeekFormat in the template.
public : DayOfWeekFormat IncludeDayOfWeek { get; }public DayOfWeekFormat IncludeDayOfWeek { get; }Public ReadOnly Property IncludeDayOfWeek As DayOfWeekFormat// You can use this property in JavaScript.
Specifies whether the day of week is included. If it is, this property specifies the format for the day of week in the template.
IncludeHour IncludeHour IncludeHour IncludeHour
Gets the HourFormat in the template.
public : HourFormat IncludeHour { get; }public HourFormat IncludeHour { get; }Public ReadOnly Property IncludeHour As HourFormat// You can use this property in JavaScript.
Specifies whether the hour is included. If it is, this property specifies the format for the hour in the template.
IncludeMinute IncludeMinute IncludeMinute IncludeMinute
Gets the MinuteFormat in the template.
public : MinuteFormat IncludeMinute { get; }public MinuteFormat IncludeMinute { get; }Public ReadOnly Property IncludeMinute As MinuteFormat// You can use this property in JavaScript.
Specifies whether the minute is included. If it is, this property specifies the format for the minute in the template.
IncludeMonth IncludeMonth IncludeMonth IncludeMonth
Gets the MonthFormat in the template.
public : MonthFormat IncludeMonth { get; }public MonthFormat IncludeMonth { get; }Public ReadOnly Property IncludeMonth As MonthFormat// You can use this property in JavaScript.
Specifies whether the month is included. If it is, this property specifies the format for the month in the template.
IncludeSecond IncludeSecond IncludeSecond IncludeSecond
Gets the SecondFormat in the template.
public : SecondFormat IncludeSecond { get; }public SecondFormat IncludeSecond { get; }Public ReadOnly Property IncludeSecond As SecondFormat// You can use this property in JavaScript.
Specifies whether the second is included. If it is, this property specifies the format for the second in the template.
IncludeYear IncludeYear IncludeYear IncludeYear
Gets the YearFormat in the template.
public : YearFormat IncludeYear { get; }public YearFormat IncludeYear { get; }Public ReadOnly Property IncludeYear As YearFormat// You can use this property in JavaScript.
Specifies whether the year is included. If it is, this format specifies the format for the year in the template.
Languages Languages Languages Languages
Gets the priority list of language identifiers that is used when formatting dates and times.
public : IVectorView<string> Languages { get; }public IReadOnlyList<string> Languages { get; }Public ReadOnly Property Languages As IReadOnlyList<string>// You can use this property in JavaScript.
- Value
- IVectorView<PlatForm::String> IReadOnlyList<string> IReadOnlyList<string> IReadOnlyList<string>
The list of languages that is used.
Starting in : Language tags can support Unicode extensions. See the Remarks for the DateTimeFormatter(String, IIterable(String)) constructor.
Remarks
Initialize this class with a BCP-47 language tag. For example, to work with the best current user-preferred language, pass in the top value from Windows.System.UserProfile.GlobalizationPreferences.
Note
If your app passes language tags from this class to any National Language Support functions, it must first convert the tags by calling ResolveLocaleName.
LongDate LongDate LongDate LongDate
Gets the DateTimeFormatter object that formats dates according to the user's choice of long date pattern.
public : static DateTimeFormatter LongDate { get; }public static DateTimeFormatter LongDate { get; }Public Static ReadOnly Property LongDate As DateTimeFormatter// You can use this property in JavaScript.
A DateTimeFormatter object equivalent to one constructed with the "longdate" template.
LongTime LongTime LongTime LongTime
Gets the DateTimeFormatter object that formats times according to the user's choice of long time pattern.
public : static DateTimeFormatter LongTime { get; }public static DateTimeFormatter LongTime { get; }Public Static ReadOnly Property LongTime As DateTimeFormatter// You can use this property in JavaScript.
A DateTimeFormatter object equivalent to one constructed with the "longtime" template.
NumeralSystem NumeralSystem NumeralSystem NumeralSystem
Gets or sets the numbering system that is used to format dates and times.
public : PlatForm::String NumeralSystem { get; set; }public string NumeralSystem { get; set; }Public ReadWrite Property NumeralSystem As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
A string that indicates the numeral system of the formatter, such as "Latn" for the Latin numeral system (0123456789) or "Arab" for the Arabic-Indic numeral system (٠١٢٣٤٥ ٦٧٨٩).
Patterns Patterns Patterns Patterns
Gets the patterns corresponding to this template that are used when formatting dates and times.
public : IVectorView<string> Patterns { get; }public IReadOnlyList<string> Patterns { get; }Public ReadOnly Property Patterns As IReadOnlyList<string>// You can use this property in JavaScript.
- Value
- IVectorView<PlatForm::String> IReadOnlyList<string> IReadOnlyList<string> IReadOnlyList<string>
The pattern that provides the requested components in the template. See the remarks for the DateTimeFormatter class for a list of valid format patterns.
- See Also
ResolvedGeographicRegion ResolvedGeographicRegion ResolvedGeographicRegion ResolvedGeographicRegion
Gets the geographic region that was most recently used to format dates and times.
public : PlatForm::String ResolvedGeographicRegion { get; }public string ResolvedGeographicRegion { get; }Public ReadOnly Property ResolvedGeographicRegion As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The geographic region that was most recently used to format dates and times.
ResolvedLanguage ResolvedLanguage ResolvedLanguage ResolvedLanguage
Gets the language that was most recently used to format dates and times.
public : PlatForm::String ResolvedLanguage { get; }public string ResolvedLanguage { get; }Public ReadOnly Property ResolvedLanguage As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The language from the priority list of language identifiers that was most recently used to format dates and times.
Starting in : Language tags can support Unicode extensions. See the Remarks for the DateTimeFormatter(String, IIterable(String)) constructor.
Remarks
If your app passes language tags from this class to any National Language Support functions, it must first convert the tags by calling ResolveLocaleName.
ShortDate ShortDate ShortDate ShortDate
Gets the DateTimeFormatter object that formats dates according to the user's choice of short date pattern.
public : static DateTimeFormatter ShortDate { get; }public static DateTimeFormatter ShortDate { get; }Public Static ReadOnly Property ShortDate As DateTimeFormatter// You can use this property in JavaScript.
A DateTimeFormatter object equivalent to one constructed with the "shortdate" template.
ShortTime ShortTime ShortTime ShortTime
Gets the DateTimeFormatter object that formats times according to the user's choice of short time pattern.
public : static DateTimeFormatter ShortTime { get; }public static DateTimeFormatter ShortTime { get; }Public Static ReadOnly Property ShortTime As DateTimeFormatter// You can use this property in JavaScript.
A DateTimeFormatter object equivalent to one constructed with the "shorttime" template.
Template Template Template Template
Gets a string representation of this format template.
public : PlatForm::String Template { get; }public string Template { get; }Public ReadOnly Property Template As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
A string that represents this format template. If the DateTimeFormatter object was constructed with a format template or format enumerations, the string can be used to construct the same DateTimeFormatter. If a pattern was used to construct the DateTimeFormatter, this property returns the empty string. See the remarks for the DateTimeFormatter class for a list of valid format templates.
- See Also
Methods
Format(DateTime) Format(DateTime) Format(DateTime) Format(DateTime)
Returns a string representation of the provided date and time.
public : PlatForm::String Format(DateTime value)public string Format(DateTimeOffset value)Public Function Format(value As DateTimeOffset) As string// You can use this method in JavaScript.
- value
- DateTime DateTimeOffset DateTimeOffset DateTimeOffset
The date and time to be formatted.
A string that represents the date and time.
- See Also
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)public string Format(DateTimeOffset datetime, String timeZoneId)Public Function Format(datetime As DateTimeOffset, timeZoneId As String) As string// You can use this method in JavaScript.
- datetime
- DateTime DateTimeOffset DateTimeOffset DateTimeOffset
The date and time to be formatted.
- timeZoneId
- PlatForm::String String String String
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).
A string that represents the date, time, and time zone.
- See Also