Onor.io

Onor.io

Timex Oddity

A colleague spotted an odd thing that neither of us can figure out:

iex(1)> Timex.timezone(“America/Chicago”, {2015,4,12})

#<TimezoneInfo(America/Chicago - CDT (-05:00:00))>

iex(2)> Timex.timezone(“America/Chicago”, {2015,1,12})

#<TimezoneInfo(America/Chicago - CST (-06:00:00))>

I would have expected all calls to timezone in Chicago to be -06:00:00. Is the difference due to Daylight Savings Time or something else?

Marked As Solved

jerdew

jerdew

DST is probably the cause, but it could possibly be weirder things .. timezones are strange. you can set the timezone to a variable, and then examine its properties to see its local offset (offset_std) and when that offset is valid from/until:

iex> tz = Timex.timezone("America/Chicago", {2015,4,12})
iex> tz.offset_std
3600
iex> z = Timex.timezone("America/Chicago", {2015,1,12})
iex> tz.offset_std
0
iex> tz.from 
{:sunday, {{2014, 11, 2}, {1, 0, 0}}}
iex> tz.until                                           
{:sunday, {{2015, 3, 8}, {2, 0, 0}}}

Last Post!

Onor.io

Onor.io

Yeah that sure looks like it’s Daylight Savings Time. Thanks for the reply @jerdew!

Where Next?

Popular in Questions Top

hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a &gt; b) do {:ok, "a"} end if (a &lt; b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
Lily
In templates/appointment/index.html.eex: &lt;%= for appointment &lt;- @appointments do %&gt; &lt;tr&gt; &lt;td&gt;&lt;%= appoi...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

Other popular topics Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

We're in Beta

About us Mission Statement