Developer

@DATE

The DATE function returns either the current system date of the client device, or the date value specified as a parameter to the function. The function can also take an optional format parameter when called in a string context. The function supports the integral number, decimal number, and string return types.

When called in an integral or decimal number context, the DATE function will return the number of days before (negative number) or after (positive number) the date January 1, 2001. This is the Agentry epoch date. When called in a string context the function will return the date value in the default format of the client device’s locale.

The function’s first parameter, if provided, is a string and contains the date value to be returned by the function. The second parameter is also optional and is evaluated as a string. It can contain one or more of the following date format tokens, which will be used to then format the date value returned by the function. Note that this format parameter is ignored when the function is called in any context other than string:

Table 23: Rule Date Format Tokens - All date format tokens are case sensitive
Date Token Description
d Day of month as digits with no leading zero for single-digit days.
dd Day of month with leading zero for single-digit days.
ddd Day of week as three letter abbreviation. The function uses the LOCALE_SABBREVDAYNAME value associated with the device’s specified locale.
dddd Day of week as its full name. The function uses the LOCALE_SDAYNAME value associated with the device’s specified locale
M Month as digits with no leading zero for single-digit months.
MM Month as digits with leading zero for single-digit months.
MMM Month as three letter abbreviation. The function uses the LOCALE_SABBREVMONTHNAME value associated with the device’s specified locale.
MMMM Month as its full name. The function uses the LOCAL_SMONTHNAME value associated with device’s specified locale.
y Year as last two digits with no leading zero for years less than 10.
yy Year as last two digits with leading zero for years less than 10.
yyyy Full four digit year value.
non-token characters Any non-token character within the format string is passed through as is; e.g in the following string: d={MM/dd/yyyy} the resulting string will contain the slash characters separating each date element: 11/17/1967

Parameters

    @DATE ([Date String [, Format Tokens] ])
  • Date String Optional string parameter; contains the date value to be returned by the function. To format the current system date, this parameter may be set to a second call to the DATE function. A data definition such as a property or global of type Date or Date and Time may be used for this parameter. The time portion of the value will be truncated. A string may be used, provided the date is in the format MM/dd/yyyy. A numeric value may be passed for this parameter, in which case it will be treated as the number of days before or after the Agentry epoch date.
  • Format Tokens Optional string parameter; contains the date format tokens that will format the function’s return value when called in a string context. When the function is called in any other context, this parameter is ignored. A DateString must be specified before FormatTokens can be provided.

Supported Return Types

  • Integral Number
  • Decimal Number
  • String