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.
Presets |
|
Day |
||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||
Day of the Week |
|
Day of the Year |
||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||
Week of the Year |
|
Month |
||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||
Quarter |
|
Year |
||||||||||||||||||||||||||||||
|
|
|
You can also use field separators to visually chunk a date. Acceptable separators include the comma (,), forward slash (/), dash (-), period (.), or space ( ).
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).
Add |
|
Subtract | ||||||||||||||||
|
|
|