swiss v1.4.1 Swiss.DateTime View Source
Some extra functions for working with DateTimes that aren't in the native lib or on Timex.
Link to this section Summary
Functions
Returns the biggest (latest) of the given list of dates.
Returns the biggest (latest) of two dates.
Returns the smallest (earliest) of the given list of dates.
Returns the smallest (earliest) of two dates.
Helper method for getting "now" with second precision.
Link to this section Functions
Returns the biggest (latest) of the given list of dates.
Examples
iex> Swiss.DateTime.max([DateTime.from_unix!(1_577_664_000), DateTime.from_unix!(2_464_096_360), DateTime.from_unix!(1_464_096_368)])
~U[2048-01-31 15:12:40Z]
iex> Swiss.DateTime.max([DateTime.from_unix!(2_464_096_360), nil])
~U[2048-01-31 15:12:40Z]
Link to this function
max(date_1, date_2)
View Sourcemax(DateTime.t(), DateTime.t()) :: DateTime.t()
Returns the biggest (latest) of two dates.
Examples
iex> Swiss.DateTime.max(DateTime.from_unix!(1_577_664_000), DateTime.from_unix!(1_464_096_368))
~U[2019-12-30 00:00:00Z]
Returns the smallest (earliest) of the given list of dates.
Examples
iex> Swiss.DateTime.min([DateTime.from_unix!(1_577_664_000), DateTime.from_unix!(2_464_096_360), DateTime.from_unix!(1_464_096_368)])
~U[2016-05-24 13:26:08Z]
iex> Swiss.DateTime.min([DateTime.from_unix!(2_464_096_360), nil])
~U[2048-01-31 15:12:40Z]
Link to this function
min(date_1, date_2)
View Sourcemin(DateTime.t(), DateTime.t()) :: DateTime.t()
Returns the smallest (earliest) of two dates.
Examples
iex> Swiss.DateTime.min(DateTime.from_unix!(1_577_664_000), DateTime.from_unix!(1_464_096_368))
~U[2016-05-24 13:26:08Z]
Helper method for getting "now" with second precision.