NaiveDateTime.from_erl
You're seeing just the function
from_erl
, go back to NaiveDateTime module for more information.
Specs
from_erl(:calendar.datetime(), Calendar.microsecond(), Calendar.calendar()) :: {:ok, t()} | {:error, atom()}
Converts an Erlang datetime tuple to a NaiveDateTime
struct.
Attempting to convert an invalid ISO calendar date will produce an error tuple.
Examples
iex> NaiveDateTime.from_erl({{2000, 1, 1}, {13, 30, 15}})
{:ok, ~N[2000-01-01 13:30:15]}
iex> NaiveDateTime.from_erl({{2000, 1, 1}, {13, 30, 15}}, {5000, 3})
{:ok, ~N[2000-01-01 13:30:15.005]}
iex> NaiveDateTime.from_erl({{2000, 13, 1}, {13, 30, 15}})
{:error, :invalid_date}
iex> NaiveDateTime.from_erl({{2000, 13, 1}, {13, 30, 15}})
{:error, :invalid_date}