Date and Time Variables
This topic lists the predefined context variables that are related to date and time.
gateway92
This topic lists the predefined context variables that are related to date and time.
In addition to the two built-in variables, you can create your own date and time variables by using the Set Context Variable Assertion (choose the data type "Date/Time").
Variables | Descriptions |
${gateway.time. <suffix> } | Returns the current time on the Gateway; suffix is optional. |
${request.time. <suffix>} | Returns the time that the request was received; suffix is optional. |
There are several suffixes that can modify or reformat the time that is returned. These apply to both the built-in variables or to custom date/time variables. The following table summarizes these suffixes.
When a date/time variable is used without a suffix, the time value returned is in ISO 8601 format, in the UTC (Coordinated Universal Time) time zone
Suffix | Description |
.local | Returns the value in local time. |
.utc | Returns the value in UTC time. This is the same as using no suffix at all. |
. <SimpleDateFormat> | Returns the value in a specified format. You can append a format to the above suffixes (or on its own) to create unstructured suffixes using symbols from java.text.SimpleDateFormat. Examples: ${request.time.local.MM/dd/yyyy} ${gateway.time.MM/dd/yyyy For more information about the SimpleDateFormat, see https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html |
.millis | Access a timestamp in milliseconds for the variable. This suffix must appear directly after the variable (for example, ${mydate.millis}) . |
.seconds | Access a second timestamp for the variable. This suffix must appear directly after the variable (for example, ${gateway.time.seconds} ). |
.<timezone>.<formatting> | Returns the value in the specified time zone (case insensitive) with optional custom formatting. Examples: ${myvar.BST} - value of myvar is in British Standard Time formatted as an ISO 8601 string${request.time.BST.hh:mm:ss} - request is in British Standard Time with specified custom formattingTime zone suffixes are all those supported by the java.util.TimeZone.getAvailableIDs() utility. |
.<offset> | Returns the value in the local time offset by the specified <offset> value. Examples of valid values:${gateway.time.+07:00} ${gateway.time.-0700} ${gateway.time.+05:30} ${gateway.time.-0530} ${gateway.time.+07} ${gateway.time.-07} The following are examples of invalid <offset> values:${gateway.time.+7:00} ${gateway.time.-530} ${gateway.time.+7} |
.<StructuredFormat> | Returns the value in any of the following structured formats:
These suffixes can be used directly after the variable name or after a timezone: ${myvar.BST.rfc1123} - BST date string formatted according to rfc1123${myvar.rfc1123} - Date string formatted according to GMT (Zulu) time zone. |