getLocaleDateTimeFormat

Date-time format that depends on the locale.

getLocaleDateTimeFormat(locale: string, width: FormatWidth): string

参数

locale

Type: string.

width

Type: FormatWidth.

返回值

string

说明

The date-time pattern shows how to combine separate patterns for date (represented by {1}) and time (represented by {0}) into a single pattern. It usually doesn't need to be changed. What you want to pay attention to are:

  • possibly removing a space for languages that don't use it, such as many East Asian languages
  • possibly adding a comma, other punctuation, or a combining word

For example:

  • English uses {1} 'at' {0} or {1}, {0} (depending on date style), while Japanese uses {1}{0}.
  • An English formatted date-time using the combining pattern {1}, {0} could be Dec 10, 2010, 3:59:49 PM. Notice the comma and space between the date portion and the time portion.

There are four formats (full, long, medium, short); the determination of which to use is normally based on the date style. For example, if the date has a full month and weekday name, the full combining pattern will be used to combine that with a time. If the date has numeric month, the short version of the combining pattern will be used to combine that with a time. English uses {1} 'at' {0} for full and long styles, and {1}, {0} for medium and short styles.