View Source Timex.Time (timex v3.7.11)

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

@spec to_12hour_clock(0..24) :: {1..12, :am | :pm}

Converts an hour between 0..24 to {1..12, :am/:pm}

examples

Examples

iex> Timex.Time.to_12hour_clock(23)
{11, :pm}
Link to this function

to_24hour_clock(hour, am_or_pm)

View Source
@spec 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

Examples

iex> Timex.Time.to_24hour_clock(7, :pm)
19