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

getLocaleTimeFormat

npm Package @angular/common
Module import { getLocaleTimeFormat } from '@angular/common';
Source common/src/i18n/locale_data_api.ts
      
      function getLocaleTimeFormat(locale: string, width: FormatWidth): string;
    

Description

Time format that depends on the locale.

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