swirl
Guide to OmniMark 8   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
      Other Library Functions  
function  

add-to-ymdhms

 
 

Library: Date and time functions (OMDATE)
Include: omdate.xin
Return type: String

Returns: Returns the modified date/time in "YYYYMMDDhhmmss+ZHZM" format.


Declaration

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

ymdhms
the initial date/time in "YYYYMMDDhhmmss+ZHZM" format.
years-to-add
a signed numeric value representing the number of years you wish to add or subtract from the initial date/time
months-to-add
a signed numeric value representing the number of months you wish to add or subtract from the initial date/time
days-to-add
a signed numeric value representing the number of days you wish to add or subtract from the initial date/time
hours-to-add
a signed numeric value representing the number of hours you wish to add or subtract from the initial date/time
minutes-to-add
a signed numeric value representing the number of minutes you wish to add or subtract from the initial date/time
seconds-to-add
a signed numeric value representing the number of seconds you wish to add or subtract from the initial date/time


Purpose

This function takes a date/time in "YYYYMMDDhhmmss+ZHZM" format and any number of values to add or subtract from the given date/time. After the new date/time has been calculated, it is returned in "YYYYMMDDhhmmss+ZHZM" format.

Note that all except the "ymdhms" argument are optional, and that the default value of all optional arguments is 0 (zero).

Example:


  ; Add one year to the current date 
    include "omdate.xin"
    process
      local stream ymdhms  ; current date
      local integer years-to-add initial {1}
      local stream 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-date
  ; Result of this example:
  ;      Current date          = 20010214155655-0500
  ;      Current date + 1 year = 20020214155655-0500

        Other Library Functions
   add-to-ymdhms
   arpadate-to-ymdhms
   format-ymdhms
   now-as-ymdhms
   round-down-ymdhms
   round-up-ymdhms
   ymdhms-adjust-time-zone
   ymdhms-day-difference
   ymdhms-julian-day-count
   ymdhms-month-difference
   ymdhms-second-difference
   ymdhms-to-arpadate
   ymd-weekday
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 8.2.0 Documentation Generated: March 13, 2008 at 3:27:39 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2008.