$Sir Date2NM: Difference between revisions
Jump to navigation
Jump to search
m (link to datetime formats) |
m (misc cleanup) |
||
(30 intermediate revisions by 4 users not shown) | |||
Line 2: | Line 2: | ||
<span class="pageSubtitle">Convert datetime string to number of milliseconds</span> | <span class="pageSubtitle">Convert datetime string to number of milliseconds</span> | ||
<p class=" | <p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. | ||
The OO equivalent for the $Sir_Date2NM function is <var>[[StringToMilliseconds (String function)|StringToMilliseconds]]</var>.</p> | |||
The $Sir_Date2NM function expects a datetime value string and a datetime format string and returns the input datetime converted to the number of milliseconds since 1 January, 1900. It accepts an optional CENTSPAN value and an optional error control string. If an error is detected, the returned value is -9E12 (-9000000000000). | The <var>$Sir_Date2NM</var> function expects a datetime value string and a datetime format string and returns the input datetime converted to the number of milliseconds since 1 January, 1900. It accepts an optional <var>CENTSPAN</var> value and an optional error control string. If an error is detected, the returned value is <code>-9E12</code> (-9000000000000). | ||
==Syntax== | ==Syntax== | ||
<p class="syntax">< | <p class="syntax"><span class="term">%num</span> <span class="literal">= $Sir_Date2NM(</span><span class="term">dat</span><span class="literal">,</span> <span class="term">fmt</span><span class="literal">,</span> <span class="term">span</span><span class="literal">,</span> <span class="term">errctl</span><span class="literal">)</span> | ||
< | |||
< | |||
</p> | </p> | ||
===Syntax terms=== | |||
<table class="syntaxTable"> | |||
<tr><th>%num</th> | |||
<td>Set to the value of <var class="term">dat</var>, converted to the number of milliseconds from <code>1 Jan 1900 12:00 AM</code>. | |||
</td></tr> | |||
<tr><th>dat</th> | <tr><th>dat</th> | ||
<td> | <td>Datetime value string.</td></tr> | ||
<tr><th>fmt</th> | <tr><th>fmt</th> | ||
<td> | <td>Datetime format string corresponding to <var class="term">dat</var>. Refer to [[Datetime string formats|datetime formats]] for an explanation of valid datetime formats and valid dates. Non-strict matching is used for input format <var class="term">fmt</var>; see [[Datetime string formats#Strict and non-strict format matching|Strict and non-strict format matching]].</td></tr> | ||
<tr><th>span</th> | <tr><th>span</th> | ||
<td> | <td>Optional <var>CENTSPAN</var> value, default is -50. </td></tr> | ||
<tr><th>errctl</th> | <tr><th>errctl</th> | ||
<td> | <td>Optional error control string; refer to [[Datetime string formats#Datetime error handling|Datetime error handling]].</td></tr> | ||
</td></tr> | |||
</table> | </table> | ||
==Usage notes== | |||
<ul> | |||
<li>Values returned by <var>$Sir_Date2NM</var> will often exceed the range that can be represented in a 4-byte integer, so you should probably avoid storing the value in a <var>BINARY</var> or <var>FLOAT4</var> field. </li> | |||
<li>Dates prior to 1 January 1900 will return a negative number. </li> | |||
< | <li>The inverse of this $function is <var>[[$Sir_NM2Date]]</var>.</li> | ||
</ | |||
<li><var>$Sir_Date2NM</var> returns the value <code>-9E12</code> (-9000000000000) in the following cases (see the discussion in [[Datetime string formats#Datetime error handling|Datetime error handling]]): | |||
<ul> | <ul> | ||
<li> | <li><var class="term">fmt</var> is not a valid datetime format.</li> | ||
<li | |||
< | <li><var class="term">dat</var> does not match <var class="term">fmt</var>.</li> | ||
<li><var class="term">dat</var> is outside of range permitted for <var class="term">fmt</var>.</li> | |||
< | <li><var class="term">span</var> is invalid.</li> | ||
< | </ul></li> | ||
<li> | |||
<li> | |||
</ul> | </ul> | ||
==Products authorizing {{PAGENAMEE}}== | |||
<ul class="smallAndTightList"> | <ul class="smallAndTightList"> | ||
<li>[[Sirius functions]]</li> | <li>[[List of $functions|Sirius functions]]</li> | ||
<li>[[Fast/Unload User Language Interface]]</li> | <li>[[Fast/Unload User Language Interface]]</li> | ||
<li>[[Janus Open Client]]</li> | <li>[[Media:JoclrNew.pdf|Janus Open Client]]</li> | ||
<li>[[Janus Open Server]]</li> | <li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li> | ||
<li>[[Janus Sockets]]</li> | <li>[[Janus Sockets]]</li> | ||
<li>[[Janus Web Server]]</li> | <li>[[Janus Web Server]]</li> | ||
<li> | <li>Japanese functions</li> | ||
<li>[[Sir2000 Field Migration Facility]]</li> | <li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li> | ||
<li>[ | <li>[http://m204wiki.rocketsoftware.com/images/d/d6/Ul2krNew.pdf Sir2000 User Language Tools]</li> | ||
</ul> | </ul> | ||
[[Category:$Functions|$Sir_Date2NM]] | [[Category:$Functions|$Sir_Date2NM]] |
Latest revision as of 21:47, 6 October 2015
Convert datetime string to number of milliseconds
Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Sir_Date2NM function is StringToMilliseconds.
The $Sir_Date2NM function expects a datetime value string and a datetime format string and returns the input datetime converted to the number of milliseconds since 1 January, 1900. It accepts an optional CENTSPAN value and an optional error control string. If an error is detected, the returned value is -9E12
(-9000000000000).
Syntax
%num = $Sir_Date2NM(dat, fmt, span, errctl)
Syntax terms
%num | Set to the value of dat, converted to the number of milliseconds from 1 Jan 1900 12:00 AM .
|
---|---|
dat | Datetime value string. |
fmt | Datetime format string corresponding to dat. Refer to datetime formats for an explanation of valid datetime formats and valid dates. Non-strict matching is used for input format fmt; see Strict and non-strict format matching. |
span | Optional CENTSPAN value, default is -50. |
errctl | Optional error control string; refer to Datetime error handling. |
Usage notes
- Values returned by $Sir_Date2NM will often exceed the range that can be represented in a 4-byte integer, so you should probably avoid storing the value in a BINARY or FLOAT4 field.
- Dates prior to 1 January 1900 will return a negative number.
- The inverse of this $function is $Sir_NM2Date.
- $Sir_Date2NM returns the value
-9E12
(-9000000000000) in the following cases (see the discussion in Datetime error handling):- fmt is not a valid datetime format.
- dat does not match fmt.
- dat is outside of range permitted for fmt.
- span is invalid.