You must have already guessed that the date pipe formats a date value as a string based on the requested format. The time zone of the formatted output will be the local system time zone of the end user's machine. Its syntax is pretty simple:
date_expression | date[:format[:timezone[:locale]]]
The expression input must be a date object or a number (milliseconds since the UTC epoch). The format argument is highly customizable and accepts a wide range of variations based on date-time symbols. For our convenience, some aliases have been made available as shortcuts to the most common date formats:
- 'medium': This is equivalent to 'yMMMdjms' (for example, Sep 3, 2010, 12:05:08 PM for en-US)
- 'short': This is equivalent to 'yMdjm' (for example, 9/3/2010, 12:05 PM
for en-US) - 'fullDate': This is equivalent to 'yMMMMEEEEd' (for example, Friday, September 3, 2010 for en-US)
- 'longDate': This is equivalent to 'yMMMMd' (for example, September 3, 2010)
- 'mediumDate': This is equivalent to 'yMMMd' (for example, Sep 3, 2010 for en-US)
- 'shortDate': This is equivalent to 'yMd' (for example, 9/3/2010 for en-US)
- 'mediumTime': This is equivalent to 'jms' (for example, 12:05:08 PM for en-US)
- 'shortTime': This is equivalent to 'jm' (for example, 12:05 PM for en-US)
- The json pipe