ymdhms-second-difference

function

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

Returns: Returns the number of seconds difference between two specified dates.


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

Argument definitions

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


Purpose

ymdhms-second-difference takes two date/time values and returns the number of seconds difference between them. The two dates can be in different time zones.

Example

This example uses ymdhms-second-difference to calculate the number seconds elapsed between two dates.

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

Usage Note

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

  include "omdate.xin"