Time.add
You're seeing just the function
add
, go back to Time module for more information.
Specs
add(Calendar.time(), integer(), System.time_unit()) :: t()
Adds the number
of unit
s to the given time
.
This function accepts the number
measured according to Calendar.ISO
.
The time is returned in the same calendar as it was given in.
Note the result value represents the time of day, meaning that it is cyclic, for instance, it will never go over 24 hours for the ISO calendar.
Examples
iex> Time.add(~T[10:00:00], 27000)
~T[17:30:00.000000]
iex> Time.add(~T[11:00:00.005], 2400)
~T[11:40:00.005000]
iex> Time.add(~T[00:00:00], 86_399_999, :millisecond)
~T[23:59:59.999000]
iex> Time.add(~T[17:10:05], 86400)
~T[17:10:05.000000]
iex> Time.add(~T[23:00:00], -60)
~T[22:59:00.000000]