$Web Date, $Web DateND, $Web DateNM, and $Web DateNS: Difference between revisions

From m204wiki
Jump to navigation Jump to search
Line 13: Line 13:




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 :
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 :
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>$Web_Date</th>
<tr><th>$Web_Date</th>
Line 26: Line 26:
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).  
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.
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,
For example,
<p class="code"> %RC = $Web_Expire($Web_DateNS + 24 * 60 * 60)
<p class="code"> %RC = $Web_Expire($Web_DateNS + 24 * 60 * 60)

Revision as of 20:54, 15 June 2012

<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_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.

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_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,

%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