Date.to_iso8601
You're seeing just the function
to_iso8601
, go back to Date module for more information.
Specs
to_iso8601(Calendar.date(), :extended | :basic) :: String.t()
Converts the given date
to
ISO 8601:2019.
By default, Date.to_iso8601/2
returns dates formatted in the "extended"
format, for human readability. It also supports the "basic" format through passing the :basic
option.
Only supports converting dates which are in the ISO calendar,
or other calendars in which the days also start at midnight.
Attempting to convert dates from other calendars will raise an ArgumentError
.
Examples
iex> Date.to_iso8601(~D[2000-02-28])
"2000-02-28"
iex> Date.to_iso8601(~D[2000-02-28], :basic)
"20000228"
iex> Date.to_iso8601(~N[2000-02-28 00:00:00])
"2000-02-28"