$Web Date, $Web DateND, $Web DateNM, and $Web DateNS: Difference between revisions
Jump to navigation
Jump to search
m (moved $Web Date $Web DateND $Web DateNM and $Web DateNS to $Web Date, $Web DateND, $Web DateNM, and $Web DateNS: title needs commas) |
(Automatically generated page update) |
||
(13 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" | <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. | |||
==Syntax== | ==Syntax== | ||
<p class="syntax" | <p class="syntax">%DATETIME = $Web_Date | ||
%DATETIME = $Web_DateND | |||
%DATETIME = $Web_DateNM | |||
%DATETIME = $Web_DateNS | |||
</p> | |||
==Usage notes== | |||
Each of the $ | <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> | ||
The units returned by the $ | <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"> % | <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 | 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 | |||
</p> | </p> | ||
See also | <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== | |||
<ul> | <ul> | ||
<li> | <li><var>[[$Web_Date2D, $Web_Date2N, $Web_Date2ND, $Web_Date2NM, $Web_Date2NS]]</var> | ||
<li> | <li><var>[[$Web_D2Date, $Web_N2Date, $Web_ND2Date, $Web_NM2Date, $Web_NS2Date]]</var> | ||
</ul> | </ul> | ||
[[Category:Janus Web Server $functions|$Web_Date, $Web_DateND, $Web_DateNM, and $Web_DateNS]] | [[Category:Janus Web Server $functions|$Web_Date, $Web_DateND, $Web_DateNM, and $Web_DateNS]] |
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.