Date / Time

Overview

Output a date or time string based on a supplied template.

Template tokens

The template determines the format that the date will be created. This allows you to create a dates such as 23/12/19 or 12/23/2019 or just about any other date or time format you might need.

Tokens are used to represent the part of a date or time. For example, the token YYYY represent a four digit year.

Date Tokens

Token Description Example
YYYY or yyyy 4 digit year 2018
YY or yy 2 digit year 18
MM Month number 01, 12
M Month number 1, 12
DD or dd Day of month 01, 21, 31
D Day of month 1, 21, 31
Do Day of month with ordinal 1st, 3rd
DDD or ddd Day of year 5, 23, 245
DDDD or dddd Day of year 005, 023, 245
W Week of year (ISO) 1, 26
WW Week of year (ISO) 01, 26
w Week of year 1, 26
ww Week of year 01, 26

Time Tokens

Token Description Example
H Hours (24 hour time) 1, 17
HH Hours (24 hour time) 01, 17
h Hours (12 hour time) 1, 5
hh Hours (12 hour time) 01, 05, 11
a Post or ante meridiem am, pm
A Post or ante meridiem AM, PM
m Minutes 1, 26
mm Minutes 01, 26
s Seconds 3, 48
ss Seconds 03, 48
S millseconds 1, 10, 245
SS millseconds 01, 10, 245
SSS millseconds 001, 010, 245

Day Offset

You can supply a day offset. The default offset is o which means any dates created will be today. An offset of -1 will means the date created will be yesterday and an offset of 1 will be tomorrow.