• Overview
@angular/common

DatePipe

pipe

Formats a date value according to locale rules.

  
    class DatePipe implements PipeTransform {
}

transform

3 overloads
@paramvaluestring | number | Date

The date expression: a Date object, a number (milliseconds since UTC epoch), or an ISO string (https://www.w3.org/TR/NOTE-datetime).

@paramformatstring | undefined

The date/time components to include, using predefined options or a custom format string. When not provided, the DatePipe looks for the value using the DATE_PIPE_DEFAULT_OPTIONS injection token (and reads the dateFormat property). If the token is not configured, the mediumDate is used as a value.

@paramtimezonestring | undefined

A timezone offset (such as '+0430'). When not provided, the DatePipe looks for the value using the DATE_PIPE_DEFAULT_OPTIONS injection token (and reads the timezone property). If the token is not configured, the end-user's local system timezone is used as a value.

@paramlocalestring | undefined

A locale code for the locale format rules to use. When not supplied, uses the value of LOCALE_ID, which is en-US by default. See Setting your app locale.

@returnsstring | null
@paramvaluenull | undefined
@paramformatstring | undefined
@paramtimezonestring | undefined
@paramlocalestring | undefined
@returnsnull
@paramvaluestring | number | Date | null | undefined
@paramformatstring | undefined
@paramtimezonestring | undefined
@paramlocalestring | undefined
@returnsstring | null
Jump to details