std-date-diff, std-date-sum


Synopsis

(std-date-sum <date1> <date2>) ; adds two dates

(std-date-diff <date1> <date2>) ; subtracts two dates

Description

Does arithmetic calculations with DATE objects, which may be defined in one of the three main formats, DATE, CDATE or DATLST. The proper format is "guessed" from the value of each argument. If 19000000 < date < 20320000 then the CDATE format is assumed, as list the DATLST format otherwise the DATE format which represents the day, with possible fractional parts

Defined is addition and subtraction.

They return the calculated date in CDATE format for easier readability and convertability, not for maximal accuracy.

If accuracy in the milliseconds range is required the preferred ways is calculating via DATE numbers manually.

Note

The numeric precision with CDATE numbers is maximally kept to seconds but not to milliseconds! See STD-CDATE-DATE why CDATE is a bad format for seconds and milliseconds.

Arguments

date1, date2: Numbers or list of numbers. A date in either DATE, CDATE or DATLST format. Any number between 19000000 and 20320000 is treated as special CDATE all other numbers are days and their fractional parts.

Return Value

Returns the calculated date in CDATE format for easier readability and convertability, not for maximal accuracy.

Side Effects

None.

Module

(std-require 'STDTIME)

#- SMALL

Defined in STDTIME