Calendar v1.0.0 Calendar.Time.Parse View Source

Link to this section Summary

Functions

Parses ISO 8601 time strings.

Parses ISO 8601 time strings.

Link to this section Functions

Parses ISO 8601 time strings.

The function accepts both the extended and the basic format.

Examples

# Extended format
iex> iso8601("13:07:58")
{:ok, %Time{hour: 13, minute: 7, second: 58}}
# Basic format (the basic format does not have colons)
iex> iso8601("130758")
{:ok, %Time{hour: 13, minute: 7, second: 58}}
iex> iso8601("25:65:00")
{:error, :invalid_time}

Parses ISO 8601 time strings.

Like iso_8601/1, but returns the result untagged and raises in case of an error.

Examples

# Extended format
iex> iso8601!("13:07:58")
%Time{hour: 13, minute: 7, second: 58}