$Web_Date, $Web_DateND, $Web_DateNM, and $Web_DateNS

From m204wiki
Revision as of 20:17, 12 June 2012 by JALWiccan (talk | contribs) (1 revision)
Jump to navigation Jump to search

<section begin="desc" />$Web_DateND, $Web_DateNM, and $Web_DateNS: Current date as number<section end="desc" />


The $Web_Datexx 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

<section begin="syntax" /> %DATETIME = $Web_Date %DATETIME = $Web_DateND %DATETIME = $Web_DateNM %DATETIME = $Web_DateNS <section end="syntax" />


Each of the $WEB_DATExx functions takes no arguments and returns a number. The time units returned by the various flavors of $WEB_DATExx 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.

Only $Web_Date was available before Version 4.6 of the Sirius Mods. $Web_Date produces identical results to $WEB_DATENS so, 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_DATExx 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,

%RC = $Web_Expire($Web_DateNS + 24 * 60 * 60)

sets an expiration time for the current URL of 24 hours hence.

%WEBDATENM = $Web_DateNM CHANGE TIMESTAMP TO %WEBDATENM

sets a timestamp in a record to the current time in milliseconds. 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.

See also:

  • [[$Web_Date2D, $Web_Date2N, $Web_Date2ND, $Web_Date2NM, $Web_Date2NS]]
  • [[$Web_D2Date, $Web_N2Date, $Web_ND2Date, $Web_NM2Date, $Web_NS2Date]]