Library: Date and time functions (OMDATE)
Returns: Returns the number of months difference between two specified dates.
define integer function ymdhms-month-difference (value string first-date, value string second-date)
ymdhms-month-difference takes two dates and returns a signed value representing the number of months
difference between the two dates. The result is rounded down to the largest number of months less than or equal to
the difference. The two specified dates can be in different time zones.
This example uses
ymdhms-month-difference to calculate the number months elapsed between two dates.
include "omdate.xin" process local integer elapsed-months set elapsed-months to ymdhms-month-difference ("19980416155545+0500", "19710401080000+0000") output "%d(elapsed-months) months have elapsed between the specified dates/times.%n"The output of this program is
324 months have elapsed between the specified dates/times.
ymdhms-month-difference, you must include the following code near the top of your program: