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
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}}}
1
Last Post!
Popular in Questions
lets say i have a sample like
a = 20; b = 10;
if (a > b) do
{:ok, "a"}
end
if (a < b) do
{:ok, b}
end
if (a == b) do
{:ok, "equa...
New
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
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
In templates/appointment/index.html.eex:
<%= for appointment <- @appointments do %>
<tr>
<td><%= appoi...
New
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
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 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
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
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum.
...
New
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
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
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
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
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









