Timex.Format.Time.Formatters.Default
Handles formatting timestamp values as ISO 8601 durations as described below.
Durations are represented by the format P[n]Y[n]M[n]DT[n]H[n]M[n]S. In this representation, the [n] is replaced by the value for each of the date and time elements that follow the [n]. Leading zeros are not required, but the maximum number of digits for each element should be agreed to by the communicating parties. The capital letters P, Y, M, W, D, T, H, M, and S are designators for each of the date and time elements and are not replaced.
- P is the duration designator (historically called "period") placed at the start of the duration representation.
- Y is the year designator that follows the value for the number of years.
- M is the month designator that follows the value for the number of months.
- D is the day designator that follows the value for the number of days.
- T is the time designator that precedes the time components of the representation.
- H is the hour designator that follows the value for the number of hours.
- M is the minute designator that follows the value for the number of minutes.
- S is the second designator that follows the value for the number of seconds.
Summary↑
format(timestamp) | Return a human readable string representing the time interval |
Functions
Specs:
- format(Timex.Date.timestamp) :: String.t
Return a human readable string representing the time interval.
Examples
iex> {1435, 180354, 590264} |> Elixir.Timex.Format.Time.Formatters.Default.format
"P45Y6M5DT21H12M34.590264S"
iex> {0, 65, 0} |> Elixir.Timex.Format.Time.Formatters.Default.format
"PT1M5S"