CST date and time handling

Updated 6 months ago by CST

Date and date/time management, to verifyValue <locator> <date> or to type <locator> <date>, is a necessity, but by the nature of the multiple date formats, is cumbersome to write.

Here we offer a few examples of custom date-time formatting ( using javascript both inline javascript{} and storeEval to save it to a variable ), plus prepared actions such as {!TODAY+-<days>} and {!NOW+-hours}.

commandparameter 1parameter 2result
echojavascript{(new Intl.DateTimeFormat('en-us', {day: 'numeric', month: 'short', year: 'numeric' })).format(new Date()).replace(',','')}[Dec 27 2017]
echoThe date is {!TODAY} and the date+time is {!NOW}
[The date is 12/27/2017 and the date+time is 12/27/2017 6:57 AM]
echoTomorrow will be {!TODAY+1}[Tomorrow will be 12/28/2017]
echoIn one hour it will be {!NOW+1}[In one hour it will be 12/27/2017 7:57 AM]
storeEval(new Intl.DateTimeFormat('en-us', {weekday: 'long', day: 'numeric', month: 'short', year: 'numeric', 'hour12': true, hour: 'numeric', minute: 'numeric' })).format(new Date()).replace(',','')FULL_DATE_TIME[Wednesday Dec 27, 2017, 6:57 AM]
echo{!FULL_DATE_TIME}[Wednesday Dec 27, 2017, 6:57 AM]

How did we do?