formatDate

function

Formats a date according to locale rules.

See more...

formatDate(value: string | number | Date, format: string, locale: string, timezone?: string): string

Parameters

value

Type: string | number | Date.

format

Type: string.

locale

Type: string.

timezone

Type: string.

Optional. Default is undefined.

Returns

string

Description

Where:

  • value is a Date, a number (milliseconds since UTC epoch) or an ISO string (https://www.w3.org/TR/NOTE-datetime).
  • format indicates which date/time components to include. See DatePipe for more details.
  • locale is a string defining the locale to use.
  • timezone to be used for formatting. It understands UTC/GMT and the continental US time zone abbreviations, but for general use, use a time zone offset (e.g. '+0430'). If not specified, host system settings are used.

See DatePipe for more details.

© 2010–2019 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v6.angular.io/api/common/formatDate