$Sir Date2ND: Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 58: Line 58:
<li>Values returned by $Sir_Date2ND can be stored in a BINARY or FLOAT4 field, if you wish.  
<li>Values returned by $Sir_Date2ND can be stored in a BINARY or FLOAT4 field, if you wish.  
<li>Dates prior to 1 January 1900 will return a negative number.  
<li>Dates prior to 1 January 1900 will return a negative number.  
<li>The inverse of this $function is $Sir_ND2Date.
<li>The inverse of this $function is <var>[[$Sir_ND2Date]]</var>.
</ul>
</ul>



Revision as of 20:13, 6 February 2012

Convert datetime string to number of days

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


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

<section begin="syntax" /> %num = $Sir_Date2ND(dat, fmt, span, errctl) <section end="syntax" />

$Sir_Date2ND Function

where

dat datetime value string.
fmt datetime format string corresponding to dat. Refer to for an explanation of valid datetime formats and valid dates. Non-strict matching is used for input format fmt; see .
span optional CENTSPAN value, default is -50.
errctl optional error control string, refer to .
%num set to the value of dat, converted to the number of days from 1 Jan 1900 12:00 AM.


For example, the following fragment prints the value 12:

%A = $Sir_Date2ND('010695', 'MMDDYY') %B = $Sir_Date2ND('122594', 'MMDDYY') %C = %A - %B PRINT %C


Error conditions are shown in the following figure (see the discussion in ).

  • fmt is not a valid datetime format.
  • dat does not match fmt.
  • dat is outside of range permitted for fmt.
  • span is invalid.

$Sir_Date2ND returns the value -9E12 (-9000000000000) in the following cases:


Notes:

  • Values returned by $Sir_Date2ND can be stored in a BINARY or FLOAT4 field, if you wish.
  • Dates prior to 1 January 1900 will return a negative number.
  • The inverse of this $function is $Sir_ND2Date.

Products authorizing $Sir_Date2ND