timex v3.2.0 Timex.Time View Source
This module provides helper functions for working with Times
Link to this section Summary
Functions
Converts an hour between 0..24 to {1..12, :am/:pm}
Converts an hour between 1..12 in either am or pm, to value between 0..24
Link to this section Functions
Link to this function
to_12hour_clock(hour)
View Source
to_12hour_clock(0..24) :: {1..12, :am | :pm}
Converts an hour between 0..24 to {1..12, :am/:pm}
Examples
iex> Timex.Time.to_12hour_clock(23)
{11, :pm}
Link to this function
to_24hour_clock(hour, am_or_pm)
View Source
to_24hour_clock(1..12, :am | :pm) :: 0..23
Converts an hour between 1..12 in either am or pm, to value between 0..24
Examples
iex> Timex.Time.to_24hour_clock(7, :pm)
19