defmodule FooCase do
use ExUnit.CaseTemplate
using do
quote do
def sigil_Z(binary, _opts) do
{:ok, datetime, 0} = DateTime.from_iso8601(binary)
datetime
end
end
end
end
defmodule FooTest do
use FooCase
test "the truth" do
assert ~Z[2015-01-23T23:50:07Z] == DateTime.from_naive!(~N[2015-01-23T23:50:07], "Etc/UTC")
end
end
--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/d59e56aa-dde9-426b-9303-a62f2576e396%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
iex(1)> DateTime.utc_now
#DateTime<2017-06-27 14:46:54.331343Z>
iex(3)> %DateTime{year: 2000, month: 2, day: 29, zone_abbr: "CET", hour: 23, minute: 0, second: 7, microsecond: {0, 0}, utc_offset: 3600, std_offset: 0, time_zone: "Europe/Warsaw"}
#DateTime<2000-02-29 23:00:07+01:00 CET Europe/Warsaw>
$ iex -S mix
iex(1)> DateTime.utc_now
~Z[2017-09-08 21:04:17.404239]
iex(2)> Calendar.DateTime.shift_zone!(~Z[2017-09-08 21:04:17.404239], "America/New_York")
#DateTime<2017-09-08 17:04:17.404239-04:00 EDT America/New_York>