DateTime.diff
You're seeing just the function
diff
, go back to DateTime module for more information.
Specs
diff(Calendar.datetime(), Calendar.datetime(), System.time_unit()) :: integer()
Subtracts datetime2
from datetime1
.
The answer can be returned in any unit
available from System.time_unit/0
.
Leap seconds are not taken into account.
This function returns the difference in seconds where seconds are measured
according to Calendar.ISO
.
Examples
iex> dt1 = %DateTime{year: 2000, month: 2, day: 29, zone_abbr: "AMT",
...> hour: 23, minute: 0, second: 7, microsecond: {0, 0},
...> utc_offset: -14400, std_offset: 0, time_zone: "America/Manaus"}
iex> dt2 = %DateTime{year: 2000, month: 2, day: 29, zone_abbr: "CET",
...> hour: 23, minute: 0, second: 7, microsecond: {0, 0},
...> utc_offset: 3600, std_offset: 0, time_zone: "Europe/Warsaw"}
iex> DateTime.diff(dt1, dt2)
18000
iex> DateTime.diff(dt2, dt1)
-18000