DateDifference - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Calendar

  

DateDifference

  

compute the time between two dates

 

Calling Sequence

Parameters

Description

Examples

Compatibility

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

withCalendar:

d1Date2016,3,4,2,2,0,timezone=America/Caracas

d1<Date: 2016-03-04T02:02:00 Venezuela Time>

(1)

d2Date1997&comma;1&comma;1&comma;0&comma;timezone=Asia/Hong_Kong

d2<Date: 1997-01-01 Hong Kong Standard Time>

(2)

DateDifferenced2&comma;d1

605025120000ms

(3)

DateDifferenced2&comma;d1&comma;units=days

1260469180d

(4)

DateDifferenced2&comma;d1&comma;units=hours

252093815h

(5)

DateDifferenced2&comma;d1&comma;units=mixed

19yrstandard+2mo+8d+13h+3min+54s+400ms

(6)

BattleOfMarathonDate489&comma;9&comma;12

BattleOfMarathon<Date: 0490-09-12T12:00:00 GMT>

(7)

BattleOfThermopylaeDate479&comma;8&comma;20

BattleOfThermopylae<Date: 0480-08-20T12:00:00 GMT>

(8)

DateDifferenceBattleOfMarathon&comma;BattleOfThermopylae&comma;units=mixed

9yrstandard+11mo+20d+3h+55min+29s+200ms

(9)

Compatibility

• 

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

• 

For more information on Maple 2018 changes, see Updates in Maple 2018.

See Also

Calendar

convert/units

Date

Unit