formatDate
function
Formats a date according to locale rules.
formatDate(value: string | number | Date, format: string, locale: string, timezone?: string): string
Parameters
value | Type: |
format | Type: |
locale | Type: |
timezone | Type: Optional. Default is |
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. SeeDatePipe
for more details. -
locale
is astring
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