Elixir sigil for DateTime with timezone
Elixir have a new sigil_U to be relased in the upcomming 1.9.0 version.
~U[2019-05-18 21:25:06.098765Z]
This new sigil creates a UTC DateTime.
Now Elixir will have all these sigils for dates & times:
Date.new(2019, 5, 18)
=> {:ok, ~D[2019-05-18]}
Time.new(23, 55, 6, 98_765)
=> {:ok, ~T[23:55:06.098765]}
NaiveDateTime.new(2019, 5, 18, 23, 55, 6, 98_765)
=> {:ok, ~N[2019-05-18 23:55:06.098765]}
DateTime.from_iso8601("2019-05-18T23:55:06.098765+02:30")
=> {:ok, ~U[2019-05-18 21:25:06.098765Z], 9000}
Tweet