$Sir Date2ND: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
mNo edit summary
Line 2: Line 2:
<span class="pageSubtitle">Convert datetime string to number of days</span>
<span class="pageSubtitle">Convert datetime string to number of days</span>


<p class="warn"><b>Note: </b>Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Sir_Date2ND function is <var>[[StringToDays (String function)]]</var>.</p>
<p class="warn"><b>Note: </b>Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Sir_Date2ND function is <var>[[StringToDays (String function)|StringToDays]]</var>.</p>


The <var>$Sir_Date2ND</var> function expects a datetime value string and a datetime format string and returns the input datetime converted to the number of days 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 <code>-9E12</code> (-9000000000000).
The <var>$Sir_Date2ND</var> function expects a datetime value string and a datetime format string and returns the input datetime converted to the number of days 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 <code>-9E12</code> (-9000000000000).
Line 46: Line 46:
Print %c
Print %c
</p>
</p>


==Products authorizing {{PAGENAMEE}}==  
==Products authorizing {{PAGENAMEE}}==  
<ul class="smallAndTightList">
<ul class="smallAndTightList">
<li>[[Sirius functions]]</li>
<li>[[Sirius functions]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Janus Open Client]]</li>
<li>[[Janus Open Client]]</li>
<li>[[Janus Open Server]]</li>
<li>[[Janus Open Server]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Sockets]]</li>
Line 61: Line 62:
<li>''[[Sir2000 User Language Tools]]''
<li>''[[Sir2000 User Language Tools]]''
</ul>
</ul>
<p>2ND
</p>




[[Category:$Functions|$Sir_Date2ND]]
[[Category:$Functions|$Sir_Date2ND]]

Revision as of 22:05, 19 July 2013

Convert datetime string to number of days

Note: Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Sir_Date2ND function is StringToDays.

The $Sir_Date2ND function expects a datetime value string and a datetime format string and returns the input datetime converted to the number of days 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_Date2ND(dat, fmt, span, errctl)

Syntax terms

%num Set to the value of dat, converted to the number of days from 1 Jan 1900 12:00 AM.
dat Datetime value string.
fmt Datetime format string corresponding to dat. Refer to "Datetime string 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_Date2ND can be stored in a BINARY or FLOAT4 field, if you want.
  • Dates prior to 1 January 1900 will return a negative number.
  • The inverse of this $function is $Sir_ND2Date.
  • $Sir_Date2ND 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.

Example

The following fragment prints the value 12:

%a = $Sir_Date2ND('010695', 'MMDDYY') %b = $Sir_Date2ND('122594', 'MMDDYY') %c = %a - %b Print %c

Products authorizing $Sir_Date2ND