Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

formatDate

Formats a date according to locale rules.

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

The date to format, as a Date, or a number (milliseconds since UTC epoch) or an ISO date-time string.

format string

The date-time components to include. See DatePipe for details.

locale string

A locale code for the locale format rules to use.

timezone string

The time zone. A time zone offset from GMT (such as '+0430'), or a standard UTC/GMT or continental US time zone abbreviation. If not specified, uses host system settings.

Optional. Default is undefined.

Returns

string: The formatted date string.

See also