This is the archived documentation for Angular v6. Please visit angular.io to see documentation for the current version of Angular.

getLocaleTimeFormat

Time format that depends on the locale.

See more...

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

Parameters

locale

Type: string.

width

Type: FormatWidth.

Returns

string

Description

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).