$Sir DateChg: Difference between revisions
(Created page with "{{DISPLAYTITLE:$Sir_DateChg}} <span class="pageSubtitle">Add some days to datetime</span> <p class="warn"><b>Note:</b> This $function require the <var class="product">Media...") |
m (add category) |
||
Line 66: | Line 66: | ||
For more information about error handling, see the <var>[[APPDATE command|APPDATE]]</var> command, and see <var>[[Sir_Date_Err]]</var>. </p> | For more information about error handling, see the <var>[[APPDATE command|APPDATE]]</var> command, and see <var>[[Sir_Date_Err]]</var>. </p> | ||
[[Category:$Functions | [[Category:$Functions]] | ||
[[Category:Sir2000 User Language Tools]] |
Revision as of 00:13, 23 September 2015
Add some days to datetime
Note: This $function require the Sir2000 User Language Tools product.
The $Sir_DateChg function expects a datetime format string, a datetime value string, and a number of days. It accepts an optional CENTSPAN value and an optional error control string. It returns the datetime string obtained by adding the indicated number of days to the input datetime; the return datetime string is in the same format as the input datetime string.
The $Sir_DateChg function is similar to the $DateChg function. However, the $DateChg function does not support the specification of a CENTSPLT or a DEFCENT argument.
Syntax
%odat = $Sir_DateChg(fmt, dat, days, span, errctl)
Where:
fmt | Datetime format string, describes dat and %odat. Refer to Datetime string formats for an explanation of valid datetime formats and valid datetime values. Strict matching is used for fmt. |
---|---|
dat | Datetime value string. |
days | Number of days to add to dat. |
span | Optional CENTSPAN value, default is -50. Refer to Using CENTSPAN. |
errctl | Optional error control string. Refer to Datetime error handling. |
%odat | Set to dat plus days 24-hour periods, unless an error is detected. |
Example
The following fragment prints the date one week after the run date:
%x = $sir_date('DAY Month, YYYY') Print $sir_datechg('DAY Month, YYYY', %x, 7)
Error conditions
$Sir_DateChg returns a string composed of all asterisks (*), whose length is the shorter of the length of the input date format string or 32, in the following error cases:
- fmt is not a valid datetime format.
- date does not match fmt or result date out of range.
- days is omitted.
- span contains an invalid CENTSPAN specification.
For more information about error handling, see the APPDATE command, and see Sir_Date_Err.