Dates and Time
If you need to parse the format of the date, validate, manipulate or translate the date variable to another language you can use moment.js library.
Choose the required method from the library and enter it in “Calculate a value” mode:
Format Dates
moment().format(‘MMMM Do YYYY, h:mm:ss a’); // November 3rd 2022, 2:50:04 pm
moment().format(‘dddd’); // Thursday
moment().format(“MMM Do YY”); // Nov 3rd 22
moment().format(‘YYYY [escaped] YYYY’); // 2022 escaped 2022
moment().format(); // 2022-11-03T14:50:04+03:00
Relative Time
moment(“20111031”, “YYYYMMDD”).fromNow(); // 11 years ago
moment(“20120620”, “YYYYMMDD”).fromNow(); // 10 years ago
moment().startOf(‘day’).fromNow(); // 15 hours ago
moment().endOf(‘day’).fromNow(); // in 9 hours
moment().startOf(‘hour’).fromNow(); // an hour ago
Calendar Time
moment().subtract(10, ‘days’).calendar(); // 10/24/2022
moment().subtract(6, ‘days’).calendar(); // Last Friday at 2:50 PM
moment().subtract(3, ‘days’).calendar(); // Last Monday at 2:50 PM
moment().subtract(1, ‘days’).calendar(); // Yesterday at 2:50 PM
moment().calendar(); // Today at 2:50 PM
moment().add(1, ‘days’).calendar(); // Tomorrow at 2:50 PM
moment().add(3, ‘days’).calendar(); // Sunday at 2:50 PM
moment().add(10, ‘days’).calendar(); // 11/13/2022
Multiple Locale Support
moment.locale(); // en
moment().format(‘LT’); // 2:50 PM
moment().format(‘LTS’); // 2:50:04 PM
moment().format(‘L’); // 11/03/2022
moment().format(‘l’); // 11/3/2022
moment().format(‘LL’); // November 3, 2022
moment().format(‘ll’); // Nov 3, 2022