$Web_Date, $Web_DateND, $Web_DateNM, and $Web_DateNS
Jump to navigation
Jump to search
$Web_DateND, $Web_DateNM, and $Web_DateNS: Current date as number
The $Web_Date* functions get the current date and time as a number. The returned number is always in time units since 12 AM on Jan 1, 1900.
Syntax
%DATETIME = $Web_Date %DATETIME = $Web_DateND %DATETIME = $Web_DateNM %DATETIME = $Web_DateNS
Usage notes
- Each of the $Web_Date* functions takes no arguments and returns a number. The time units returned by the various flavors of $Web_Date* are :
$Web_Date Number of seconds since midnight, January 1, 1900. $Web_DateND Number of days since midnight, January 1, 1900. $Wdb_DateNM Number of milliseconds since midnight, January 1, 1900. $Web_DateNS Number of seconds since midnight, January 1, 1900. - $Web_Date produces identical results to $Web_DateNS. For clarity, it is recommended that $Web_DateNS be used instead of $Web_Date, since $Web_DateNS indicates the time units being returned (number of seconds).
- The units returned by the $Web_Date* functions are convenient to manipulate because there are no idiosyncrasies of date/time formats to deal with and can be useful as inputs to other web $functions or as time stamps.
For example, this sets an expiration time for the current URL of 24 hours hence:
%rc = $Web_Expire($Web_DateNS + 24 * 60 * 60)
The following sets a timestamp in a record to the current time in milliseconds.
%WEBDATENM = $Web_DateNM CHANGE TIMESTAMP TO %WEBDATENM
- In general, $Web_DateNS is the preferred $Web_Date function because its time units match the resolution of web timestamps such a those used in $Web_Expire and $Web_Last_Modified processing. While it might be tempting to use the very high resolution provided by $Web_Date2NM, this resolution would be lost if used in expiration or last-modified processing and could be the source of application bugs.