Date

3.2.6 Date

DESCRIPTION

Date - Read, write and calculate dates. The command allows to take the current date or parse the input one, perform an optional time increase/decrease operation and save the result in the specified format to the _DATE variable or to the specified custom one.

The command populates these variables:

Variable NameDescription
_DATEThe output date formatted by the specified format.
_DATE_MSThe output date in milliseconds elapsed since 1 Jan 1970 UTC.

SYNOPSIS

date [date=<date>] [informat=<pattern>] [outformat=<pattern>] [add=<time_value>] [var=<name>] 

OPTIONS

date=<date>

The input date string (optional). If not specified the command defaults to the current date.

informat=<pattern>

A java.text.SimpleDateFormat compliant format to be used to parse the input date (optional). If not specified the command defaults to the _DATE format specified in the Language screen of the Preferences window.

outformat=<pattern>

A java.text.SimpleDateFormat compliant format to be used to for the output date (optional). If not specified the command defaults to the _DATE format specified in the Language screen of the Preferences window.

add=<time_value>

A time value to add to or subtract from the input date (optional). For example, the value of "-1d" will subtract one day.

var=<name>

A variable name to save the output date to (optional). It defaults to _DATE.

RETURNS

The command returns 0 (SUCCESS) or 1 if the format is invalid or the input date failed to parse.

EXAMPLES

Date outformat="EEEE d MMMM y" var="TODAY"

- Save today's date in the specified format to the TODAY variable, for example "Wednesday 13 May 2020".

Date add="-1d" outformat="EEEE" var="YESTERDAY"

- Save the yesterday's day name to the "YESTERDAY" variable, for example "Tuesday".

Date date="2020-05-08T00:00:00.000Z" informat="yyyy-MM-dd'T'HH:mm:ss.SSS" outformat="d/M/y" var="ISODATE"

- Parse the specified ISO date and save it in a simple day/month/year format to the "ISODATE" variable.