@DATE_AND_TIME

The DATE_AND_TIME function returns either the current system date and time of the client device, or the date and time value specified as an optional 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 function will return the number of seconds before (negative value) or after (positive value) the date and time of January 1, 2001 - 12:00:01 AM. This is the Agentry epoch date and time. When called in a string context, the function will return a date and time value in the default format for the client device’s locale.

The function’s first parameter, if provided, is a string and contains the date and time 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 date and time format tokens. The syntax for this parameter is as follows:
d={date format tokens} t={time format tokens}

The tokens within the curly braces will be used to format the date and time value returned by the function:

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
Rule Time Format Tokens - All time format tokens are case sensitive
Time Token Description
h Hour of day in 12 hour clock format with no leading zero for single digit hours.
hh Hour of day in 12 hour clock format with leading zero for single digit hours.
H Hour of day in 24 hour clock format with no leading zero for single digit hours.
HH Hour of day in 24 hour clock format with leading zero for single digit hours.
m Minute of the hour with no leading zero for single digit minutes.
mm Minute of the hour with leading zero for single digit minutes.
s Seconds of the minute with no leading zero for single digit minutes.
ss Seconds of the minute with leading zero for single digit minutes.
t One character time marker string, such as A or P.
tt Two character time marker string, such as AM or PM.
non-token characters Any non-token character within the format string is passed through as is; e.g in the following string: t={hh:mm:ss} the resulting string will contain the colon characters separating each time element: 10:12:32

Parameters

@DATE_AND_TIME ([Date Time String [, Format Tokens] ])
Date Time String
Optional string parameter; contains the date and time value to be returned by the function. To format the current system date and time, this parameter may be set to a second call to the DATE_AND_TIME function. A data definition such as a property or global of type Date, Date and Time, or Time may be used for this parameter. A string may be used, provided the date and time is in the format hh:mm:ss MM/dd/yyyy. A numeric value may be passed for this parameter, in which case it will be treated as the number of seconds before or after the Agentry epoch date and time.
Format Tokens
Optional string parameter; contains the date and time 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 Date Time String must be specified before Format Tokens can be provided.

Supported Return Types

  • Integral Number
  • Decimal Number
  • String