Templates

Formatting date values

You can output date values in multiple ways:

  • current date using the {{ date }} helper
  • other special dates relative to the current date like lastmonth or yesterday
  • any work item field that has a date type
Current date: {{ date }}
Current date with format: {{ date 'dd.mm.yyyy' }}
Special date with format: {{ date 'lastmonth' format='mmmm' }}

All special dates available:
- {{ date 'yesterday' }}
- {{ date 'today' }}
- {{ date 'tomorrow' }} 
- {{ date 'lastmonth' }} 
- {{ date 'nextmonth' }}

To format a work item field use this syntax

{{ field 'CreatedDate' format='dd.mm.yyyy' }}

Date formatting reference

Use these in a date format string

MaskDescription
dDay of the month as digits; no leading zero for single-digit days.
ddDay of the month as digits; leading zero for single-digit days.
dddDay of the week as a three-letter abbreviation.
DDD"Ysd", "Tdy" or "Tmw" if date lies within these three days. Else fall back to ddd.
ddddDay of the week as its full name.
DDDD"Yesterday", "Today" or "Tomorrow" if date lies within these three days. Else fall back to dddd.
mMonth as digits; no leading zero for single-digit months.
mmMonth as digits; leading zero for single-digit months.
mmmMonth as a three-letter abbreviation.
mmmmMonth as its full name.
yyYear as last two digits; leading zero for years less than 10.
yyyyYear represented by four digits.
hHours; no leading zero for single-digit hours (12-hour clock).
hhHours; leading zero for single-digit hours (12-hour clock).
HHours; no leading zero for single-digit hours (24-hour clock).
HHHours; leading zero for single-digit hours (24-hour clock).
MMinutes; no leading zero for single-digit minutes.
MMMinutes; leading zero for single-digit minutes.
NISO 8601 numeric representation of the day of the week.
oGMT/UTC timezone offset, e.g. -0500 or +0230.
pGMT/UTC timezone offset, e.g. -05:00 or +02:30.
sSeconds; no leading zero for single-digit seconds.
ssSeconds; leading zero for single-digit seconds.
SThe date's ordinal suffix (st, nd, rd, or th). Works well with d.
lMilliseconds; gives 3 digits.
LMilliseconds; gives 2 digits.
tLowercase, single-character time marker string: a or p.
ttLowercase, two-character time marker string: am or pm.
TUppercase, single-character time marker string: A or P.
TTUppercase, two-character time marker string: AM or PM.
WISO 8601 week number of the year, e.g. 4, 42
WWISO 8601 week number of the year, leading zero for single-digit, e.g. 04, 42
ZUS timezone abbreviation, e.g. EST or MDT. For non-US timezones, the GMT/UTC offset is returned, e.g. GMT-0500
'...', "..."Literal character sequence. Surrounding quotes are removed.
UTC:Must be the first four characters of the mask. Converts the date from local time to UTC/GMT/Zulu time before applying the mask. The "UTC:" prefix is removed.

Named formats

NameMaskExample
defaultddd mmm dd yyyy HH:MM:ssSat Jun 09 2007 17:46:21
shortDatem/d/yy6/9/07
paddedShortDatemm/dd/yyyy06/09/2007
mediumDatemmm d, yyyyJun 9, 2007
longDatemmmm d, yyyyJune 9, 2007
fullDatedddd, mmmm d, yyyySaturday, June 9, 2007
shortTimeh:MM TT5:46 PM
mediumTimeh:MM:ss TT5:46:21 PM
longTimeh:MM:ss TT Z5:46:21 PM EST
isoDateyyyy-mm-dd2007-06-09
isoTimeHH:MM:ss17:46:21
isoDateTimeyyyy-mm-dd'T'HH:MM:sso2007-06-09T17:46:21+0700
isoUtcDateTimeUTC:yyyy-mm-dd'T'HH:MM:ss'Z'2007-06-09T22:46:21Z
Previous
Link to work items