Manipulating Dates with Moment.js
Moment.js formulas let you manipulate stored Date Input values. You can reformat values, for example going from 2020/01/01 to January 1st, 2020. You can also add or subtract units of time, for example adding 7 days to a stored Date Input value.
Formatting Dates
Formatting formulas include tokens, like m, Do, or Y. These tokens represent a way to format your date information. To reformat stored Date Input values, use the following formula template: =moment(moment({Property ID/alias}),'format', '{tokens}'). For example =moment(moment(dateOne),'format', 'YY-MM-DD'). The following tables use Wednesday, January 9th, 1991 as a sample dateOne value.
You can also use field separators to visually chunk a date. Acceptable separators include the comma (,), forward slash (/), dash (-), period (.), or space ( ).
Presets
Token |
Outcome |
Possible Values |
---|---|---|
L |
01/09/1991 |
01-12 / 01-31 / [Year] |
l |
1/9/1991 |
1-12 / 1-31 / [Year] |
LL |
January 9 1991 |
January-December 1-31 [Year] |
ll |
Jan 9 1991 |
Jan-Dec 1-31 [Year] |
Day of the Week
Token |
Outcome |
Possible Values |
---|---|---|
d |
3 |
0 to 6 where Sunday = 0, and Saturday = 6 |
dd |
We |
Su to Sa |
ddd |
Wed |
Sun to Sat |
dddd |
Wednesday |
Sunday to Saturday |
Day of the Year
Token |
Outcome |
Possible Values |
---|---|---|
DDD |
9 |
1 to 365 |
DDDo |
9th |
1st to 365th |
DDDD |
009 |
001 to 365 |
Manipulating Dates
To add or subtract units of time from stored Date Input values, use the following formula template: =moment(moment(moment({Property ID/alias}),'{add/subtract}',{number},'{unit(s) of time}'),'format','{tokens}'). For example: =moment(moment(moment(dateOne),'add',10,'days'),'format','YYYY-MM-DD'). The following tables, use the sample dateOne value of Wednesday, January 9th, 1991 (1991-01-09).