Calendar
DateDifference
compute the time between two dates
Calling Sequence
Parameters
Description
Examples
Compatibility
DateDifference( date1, date2 )
DateDifference( date1, date2, units = u )
date1
-
Date; the first date
date2
Date; the second date
u
symbol; a Unit symbol, or the name mixed
The DateDifference( date1, date2 ) command computes the time between the dates represented by two Date objects date1 and date2.
By default, the difference of the two dates is returned using the units of the system UTC clock. This is the same result computed by the expression date2 - date1. However, you can express the time difference between date1 and date2 in other units by using the units = u option with either a valid unit symbol u (e.g., days), or the special name mixed.
with⁡Calendar:
d1≔Date⁡2016,3,4,2,2,0,timezone=America/Caracas
d1≔<Date: 2016-03-04T02:02:00 Venezuela Time>
d2≔Date⁡1997,1,1,0,timezone=Asia/Hong_Kong
d2≔<Date: 1997-01-01 Hong Kong Standard Time>
DateDifference⁡d2,d1
605025120000⁢ms
DateDifference⁡d2,d1,units=days
1260469180⁢d
DateDifference⁡d2,d1,units=hours
252093815⁢h
DateDifference⁡d2,d1,units=mixed
19⁢yrstandard+2⁢mo+8⁢d+13⁢h+3⁢min+54⁢s+400⁢ms
BattleOfMarathon≔Date⁡−489,9,12
BattleOfMarathon≔<Date: 0490-09-12T12:00:00 GMT>
BattleOfThermopylae≔Date⁡−479,8,20
BattleOfThermopylae≔<Date: 0480-08-20T12:00:00 GMT>
DateDifference⁡BattleOfMarathon,BattleOfThermopylae,units=mixed
9⁢yrstandard+11⁢mo+20⁢d+3⁢h+55⁢min+29⁢s+200⁢ms
The Calendar[DateDifference] command was introduced in Maple 2018.
For more information on Maple 2018 changes, see Updates in Maple 2018.
See Also
convert/units
Date
Unit
Download Help Document