General documentation / cheat sheets for various languages and services


date filter

{{date_expression | date}}
{{date_expression | date:format}}
{{date_expression | date:format:timezone}}
Format Interpretation Examples
yyyy4 digit representation of year0000-9999
yy2 digit representation of year, padded00-99
yvariable digit representation of year, unpadded1-9999
MMMMName of month in yearJanuary-December
MMMName of month in yearJan-Dec
MMMonth in year, padded01-12
MMonth in year1-12
ddDay in month, padded01-31
dDay in month1-31
EEEEDay in weekSunday-Saturday
EEEDay in weekSun-Sat
HHHour in 24-hour day, padded00-23
HHour in 24-hour day0-23
hhHour in AM/PM, padded01-12
hHour in AM/PM1-12
mmMinute in hour, padded00-59
mMinute in hour0-59
ssSecond in minute, padded00-59
sSecond in minute0-59
.sssMilliseconds, padded000-999
,sssMilliseconds, padded000-999
aAM/PM markerAM / PM
Z4 digit (+sign) timezone offset-1200-+1200
wwISO 8601 week of year00-53
wISO 8601 week of year0-53

The following localizable formats are also available:

Format Equivalency in en_US locale Example in en_US locale
mediumMMM d, y h:mm:ss aSep 3, 2010 12:05:08 PM
shortM/d/yy h:mm a9/3/10 12:05 PM
fullDateEEEE, MMMM d, yFriday, September 3, 2010
longDateMMMM d, ySeptember 3, 2010
mediumDateMMM d, ySep 3, 2010
mediumTimeh:mm:ss a12:05:08 PM
shortTimeh:mm a12:05 PM

The format string can contain literal values. If these are not matched by any of the format strings, they will be interpolated literally. Otherwise, they will need to be escaped by single quotes, e.g., h 'in the morning'. To output a single quote, escape it as two single quotes, e.g., h 'o''clock'.

Complete examples for dt = Date.parse('2014-12-15T20:50:03.692-0600'); // = 1418611803692:

Code Output Note
{{dt | date:'medium'}}Dec 14, 2014 8:50:03 PM
{{dt | date:'yyyy-MM-dd HH:mm:ss Z'}}2014-12-14 20:50:03 -0600
{{dt | date:'MM/dd/yyyy @ h:mma'}}12/14/2014 @ 8:50PM
{{dt | date:"MM/dd/yyyy 'at' h:mma"}}12/14/2014 at 8:50PM
{{dt | date:"yyyy-MM-ddTHH:mm:ss.sssZ"}}2014-12-14T20:50:03.692-0600ISO 8601 in local timezone
{{dt | date:"yyyy-MM-ddTHH:mm:ss.sss'Z'":'UTC'}}2014-12-15T02:50:03.692ZISO 8601 in UTC


For closures, running the following in your browser's console can be helpful to access a controller's innards:

scope = angular.element($('[ng-controller]')).scope()