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

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:$Web_Date, $Web_DateND, $Web_DateNM, and $Web_DateNS}}
{{DISPLAYTITLE:$Web_Date, $Web_DateND, $Web_DateNM, and $Web_DateNS}}
<span class="pageSubtitle"><section begin="desc" />$Web_DateND, $Web_DateNM, and $Web_DateNS: Current date as number<section end="desc" /></span>
<span class="pageSubtitle">$Web_DateND, $Web_DateNM, and $Web_DateNS: Current date as number</span>




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.


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==
==Syntax==
<p class="syntax"><section begin="syntax" /> %DATETIME = $Web_Date
<p class="syntax">%DATETIME = $Web_Date
%DATETIME = $Web_DateND
%DATETIME = $Web_DateND
%DATETIME = $Web_DateNM
%DATETIME = $Web_DateNM
%DATETIME = $Web_DateNS
%DATETIME = $Web_DateNS
<section end="syntax" /></p>
</p>
 


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 :
==Usage notes==
<ul>
<li>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 24: Line 25:
<td>Number of seconds since midnight, January 1, 1900.
<td>Number of seconds since midnight, January 1, 1900.
</td></tr></table>
</td></tr></table>
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.
<li><var>$Web_Date</var> produces identical results to <var>$Web_DateNS</var>. For clarity, it is recommended that <var>$Web_DateNS</var> be used instead of <var>$Web_Date</var>, since <var>$Web_DateNS</var> indicates the time units being returned (number of seconds).
For example,
 
<p class="code"> %RC = $Web_Expire($Web_DateNS + 24 * 60 * 60)
<li>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:
<p class="code">%rc = $Web_Expire($Web_DateNS + 24 * 60 * 60)
</p>
</p>
sets an expiration time for the current URL of 24 hours hence.
The following sets a timestamp in a record to the current time in milliseconds.  
<p class="code"> %WEBDATENM = $Web_DateNM
<p class="code">%WEBDATENM = $Web_DateNM
CHANGE TIMESTAMP TO %WEBDATENM
CHANGE TIMESTAMP TO %WEBDATENM
</p>
</p>
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 <var>[[$Web_Expire]]</var> and <var>[[$Web_Last_Modified]]</var> 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.
 
<li>In general, <var>$Web_DateNS</var> is the preferred <var>$Web_Date</var> function because its time units match the resolution of web timestamps such a those used in <var>[[$Web_Expire]]</var> and <var>[[$Web_Last_Modified]]</var> processing. While it might be tempting to use the very high resolution provided by <var>$Web_Date2NM</var>, this resolution would be lost if used in expiration or last-modified processing and could be the source of application bugs.
</ul>


==See also==
==See also==

Latest revision as of 14:39, 9 April 2013

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

See also