function
Library: Date and time functions (OMDATE)
Include: omdate.xin |
Returns: the modified date/time in |
define string function add-to-ymdhms value string ymdhms years value integer years-to-add optional initial { 0 } months value integer months-to-add optional initial { 0 } days value integer days-to-add optional initial { 0 } hours value integer hours-to-add optional initial { 0 } minutes value integer minutes-to-add optional initial { 0 } seconds value integer seconds-to-add optional initial { 0 }
Argument definitions
YYYYMMDDhhmmss+ZHZM
format. Use add-to-ymdhms
to take the starting date ymdhms and calculate a new date from it. The new
date/time is returned in YYYYMMDDhhmmss+ZHZM
format.
Note that all arguments except the ymdhms are optional, and that the default value of all optional
arguments is 0
(zero).
The following program takes the current date and adds one year to it.
include "omdate.xin" process local integer years-to-add initial {1} local string ymdhms local string incremented-date set ymdhms to now-as-ymdhms set incremented-date to add-to-ymdhms ymdhms years years-to-add output "Current date = " || ymdhms || "%n" output "Current date + 1 year = " || incremented-dateRunning this example program might yield output such as
Current date = 20191031153022-0400 Current date + 1 year = 20201031153022-0400
To use add-to-ymdhms
, you must include the following code near the top of your program:
include "omdate.xin"