DateTime.from_naive-exclamation-mark
You're seeing just the function
from_naive-exclamation-mark
, go back to DateTime module for more information.
Link to this function
from_naive!(naive_datetime, time_zone, time_zone_database \\ Calendar.get_time_zone_database())
View Source (since 1.4.0)Specs
from_naive!( NaiveDateTime.t(), Calendar.time_zone(), Calendar.time_zone_database() ) :: t()
Converts the given NaiveDateTime
to DateTime
.
It expects a time zone to put the NaiveDateTime in.
If the time zone is "Etc/UTC", it always succeeds. Otherwise,
the NaiveDateTime is checked against the time zone database
given as time_zone_database
. See the "Time zone database"
section in the module documentation.
Examples
iex> DateTime.from_naive!(~N[2016-05-24 13:26:08.003], "Etc/UTC")
~U[2016-05-24 13:26:08.003Z]
iex> DateTime.from_naive!(~N[2018-05-24 13:26:08.003], "Europe/Copenhagen", FakeTimeZoneDatabase)
#DateTime<2018-05-24 13:26:08.003+02:00 CEST Europe/Copenhagen>