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
Popular in Questions
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
Credo is smart enough to check for (something like) this:
assert length(the_list) == 0
with this response:
Checking if an enum is empt...
New
Hi,
is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
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
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
I would like to know what is the best IDE for elixir development?
New
The Elixir Typespec docs show the following syntax for keyword lists in typespecs:
# ...
| [key: type] # keyword lis...
New
Sometimes I want to check if the input into a function is not a blank string.
My first approach:
defmodule Example do
def do_stuff(s...
New
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum.
...
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
Other popular topics
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
Hi all,
Trying to get some more clarity over utc_datetime and naive_datetime for Ecto:
https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!)
This post collects co...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible.
total = 10
while total != 0
...
New
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
Hey all,
I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New







