ymdhms-day-difference

function

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

Returns: Returns the number of days difference between two given dates.


Declaration
define integer function 
   ymdhms-day-difference (value string first-date, 
                          value string second-date)

Argument definitions

first-date
the first date in YYYYMMDDhhmmss+ZHZM format
second-date
the second date, also in YYYYMMDDhhmmss+ZHZM format


Purpose

ymdhms-day-difference takes two dates and returns a signed value representing the number of days difference between them. The result is rounded down to the largest number of days less than or equal to the difference. The date/times can be in different time zones.

Example:

This example uses ymdhms-day-difference to calculate the number days elapsed between two dates.

  include "omdate.xin"
  
  process
     local integer elapsed-days
  
     set elapsed-days to ymdhms-day-difference ("19980416155545+0500", "19710401080000+0000")
  
     output "%d(elapsed-days) days have elapsed between the specified dates/times.%n"
The output of this program is
  9877 days have elapsed between the specified dates/times.

Usage Note

To use ymdhms-day-difference, you must include the following code near the top of your program:

  include "omdate.xin"