 DateDifference - Maple Help

Calendar

 DateDifference
 compute the time between two dates Calling Sequence DateDifference( date1, date2 ) DateDifference( date1, date2, units = u ) Parameters

 date1 - Date; the first date date2 - Date; the second date u - symbol; a Unit symbol, or the name mixed Description

 • 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. Examples

 > $\mathrm{with}\left(\mathrm{Calendar}\right):$
 > $\mathrm{d1}≔\mathrm{Date}\left(2016,3,4,2,2,0,'\mathrm{timezone}'="America/Caracas"\right)$
 ${\mathrm{d1}}{≔}{\mathrm{}}$ (1)
 > $\mathrm{d2}≔\mathrm{Date}\left(1997,1,1,0,'\mathrm{timezone}'="Asia/Hong_Kong"\right)$
 ${\mathrm{d2}}{≔}{\mathrm{}}$ (2)
 > $\mathrm{DateDifference}\left(\mathrm{d2},\mathrm{d1}\right)$
 ${605025120000}{}⟦{\mathrm{ms}}⟧$ (3)
 > $\mathrm{DateDifference}\left(\mathrm{d2},\mathrm{d1},'\mathrm{units}'='\mathrm{days}'\right)$
 $\frac{{1260469}}{{180}}{}⟦{d}⟧$ (4)
 > $\mathrm{DateDifference}\left(\mathrm{d2},\mathrm{d1},'\mathrm{units}'='\mathrm{hours}'\right)$
 $\frac{{2520938}}{{15}}{}⟦{h}⟧$ (5)
 > $\mathrm{DateDifference}\left(\mathrm{d2},\mathrm{d1},'\mathrm{units}'='\mathrm{mixed}'\right)$
 ${19}{}⟦{{\mathrm{yr}}}_{{\mathrm{standard}}}⟧{+}{2}{}⟦{\mathrm{mo}}⟧{+}{8}{}⟦{d}⟧{+}{13}{}⟦{h}⟧{+}{3}{}⟦{\mathrm{min}}⟧{+}{54}{}⟦{s}⟧{+}{400}{}⟦{\mathrm{ms}}⟧$ (6)
 > $\mathrm{BattleOfMarathon}≔\mathrm{Date}\left(-489,9,12\right)$
 ${\mathrm{BattleOfMarathon}}{≔}{\mathrm{}}$ (7)
 > $\mathrm{BattleOfThermopylae}≔\mathrm{Date}\left(-479,8,20\right)$
 ${\mathrm{BattleOfThermopylae}}{≔}{\mathrm{}}$ (8)
 > $\mathrm{DateDifference}\left(\mathrm{BattleOfMarathon},\mathrm{BattleOfThermopylae},'\mathrm{units}'='\mathrm{mixed}'\right)$
 ${9}{}⟦{{\mathrm{yr}}}_{{\mathrm{standard}}}⟧{+}{11}{}⟦{\mathrm{mo}}⟧{+}{20}{}⟦{d}⟧{+}{3}{}⟦{h}⟧{+}{55}{}⟦{\mathrm{min}}⟧{+}{29}{}⟦{s}⟧{+}{200}{}⟦{\mathrm{ms}}⟧$ (9) Compatibility

 • The Calendar[DateDifference] command was introduced in Maple 2018.