$Sir Date2N: Difference between revisions
m (1 revision) |
mNo edit summary |
||
Line 2: | Line 2: | ||
<span class="pageSubtitle"><section begin="desc" />Convert datetime string to number of seconds/300<section end="desc" /></span> | <span class="pageSubtitle"><section begin="desc" />Convert datetime string to number of seconds/300<section end="desc" /></span> | ||
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. | <p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is currentyly no OO equivalent for the $Sir_Date2N function.</p> | ||
The $Sir_Date2N function expects a datetime value string and a datetime format string and returns the input datetime converted to the number of 1/300th seconds 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== | ==Syntax== | ||
<p class="syntax"><section begin="syntax" /> %num = $Sir_Date2N(dat, fmt, span, errctl) | <p class="syntax"><section begin="syntax" /> %num = $Sir_Date2N(dat, fmt, span, errctl) | ||
Line 12: | Line 11: | ||
<p class="caption">$Sir_Date2N Function | <p class="caption">$Sir_Date2N Function | ||
</p> | </p> | ||
where | where | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>dat</th> | <tr><th>dat</th> | ||
Line 24: | Line 25: | ||
<tr><th>%num</th> | <tr><th>%num</th> | ||
<td>set to the value of '''dat''', converted to the number of 1/300th second units from 1 Jan 1900 12:00 AM. | <td>set to the value of '''dat''', converted to the number of 1/300th second units from 1 Jan 1900 12:00 AM. | ||
</td></tr></table> | </td></tr> | ||
</table> | |||
For example, the following fragment prints the value <tt>Before</tt>: | |||
<p class="code"> IF $Sir_Date2N('121494', 'MMDDYY') < - | <p class="code"> IF $Sir_Date2N('121494', 'MMDDYY') < - | ||
$Sir_Date2N('040195', 'MMDDYY') THEN | $Sir_Date2N('040195', 'MMDDYY') THEN | ||
Line 34: | Line 36: | ||
</p> | </p> | ||
Error conditions are shown in the following figure (see the discussion in ). | |||
Error conditions are shown in the following figure (see the discussion in ). | |||
<ul> | <ul> | ||
<li>'''fmt''' is not a valid datetime format. | <li>'''fmt''' is not a valid datetime format. | ||
<li>'''dat''' does not match '''fmt'''. | <li>'''dat''' does not match '''fmt'''. | ||
<li>'''dat''' is outside of range permitted for '''fmt'''. | <li>'''dat''' is outside of range permitted for '''fmt'''. | ||
<li>'''span''' is invalid. | <li>'''span''' is invalid. | ||
</ul> | </ul> | ||
<p class="caption"> $Sir_Date2N returns the value -9E12 (-9000000000000) in the following cases:</p> | <p class="caption"> $Sir_Date2N returns the value -9E12 (-9000000000000) in the following cases:</p> | ||
Notes: | Notes: | ||
<ul> | <ul> | ||
<li>Values returned by $Sir_Date2N 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. | <li>Values returned by $Sir_Date2N 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. | ||
<li>Dates prior to 1 January 1900 will return a negative number. | <li>Dates prior to 1 January 1900 will return a negative number. | ||
Line 70: | Line 62: | ||
<li>[[Japanese functions]]</li> | <li>[[Japanese functions]]</li> | ||
<li>[[Sir2000 Field Migration Facility]]</li> | <li>[[Sir2000 Field Migration Facility]]</li> | ||
<li>''[[Sir2000 User Language Tools]]''</li> | |||
<li>''[[Sir2000 User Language Tools]]'' | |||
</ul> | </ul> | ||
<p class="caption">Products authorizing $Sir_Date2N | <p class="caption">Products authorizing $Sir_Date2N | ||
</p> | </p> | ||
[[Category:$Functions|$Sir_Date2N]] | [[Category:$Functions|$Sir_Date2N]] |
Revision as of 19:05, 8 February 2011
<section begin="desc" />Convert datetime string to number of seconds/300<section end="desc" />
Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is currentyly no OO equivalent for the $Sir_Date2N function.
The $Sir_Date2N function expects a datetime value string and a datetime format string and returns the input datetime converted to the number of 1/300th seconds 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_Date2N(dat, fmt, span, errctl) <section end="syntax" />
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 1/300th second units from 1 Jan 1900 12:00 AM. |
For example, the following fragment prints the value Before:
IF $Sir_Date2N('121494', 'MMDDYY') < - $Sir_Date2N('040195', 'MMDDYY') THEN PRINT 'Before' END IF
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.
Notes:
- Values returned by $Sir_Date2N 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_N2Date.