getLocaleTimeFormat

Time format that depends on the locale.

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

参数

locale

Type: string.

width

Type: FormatWidth.

返回值

string

说明

The standard formats include four basic time formats:

  • full should contain hour (h/H), minute (mm), second (ss), and zone (zzzz).
  • long should contain hour, minute, second, and zone (z)
  • medium should contain hour, minute, second.
  • short should contain hour, minute.

Note: The patterns depend on whether the main country using your language uses 12-hour time or not:

  • For 12-hour time, use a pattern like hh:mm a using h to mean a 12-hour clock cycle running 1 through 12 (midnight plus 1 minute is 12:01), or using K to mean a 12-hour clock cycle running 0 through 11 (midnight plus 1 minute is 0:01).
  • For 24-hour time, use a pattern like HH:mm using H to mean a 24-hour clock cycle running 0 through 23 (midnight plus 1 minute is 0:01), or using k to mean a 24-hour clock cycle running 1 through 24 (midnight plus 1 minute is 24:01).