CST Date and Time Handling

Updated 7 months ago by Copado Solutions

Date and date/time management to verifyValue <locator> <date> or to type <locator> <date> is a necessity. However, because of the nature of the multiple date formats, it 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}.

command

parameter 1

parameter 2

result

echo

javascript{(new Intl.DateTimeFormat('en-us', {day: 'numeric', month: 'short', year: 'numeric' })).format(new Date()).replace(',','')}

[Dec 27 2017]

echo

The 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]

echo

Tomorrow will be {!TODAY+1}

[Tomorrow will be 12/28/2017]

echo

In 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?