peoj

peoj

Determining the current system timezone

How can I determine the current timezone of the local system (e.g. Etc/UTC)?

This approach would work for me, but seems like I must be missing a built-in API of some sort!

First Post!

outlog

outlog

of a client? or the server? (btw imho your server should always run in utc)

Most Liked

outlog

outlog

app logic can/should be in a way that the server timezone is irrelevant.. aka always Start with DateTime.utc_now() or similar in the logic and go from there..

anyways, maybe something like

iex(20)> :calendar.time_difference(:calendar.universal_time, :calendar.local_time  )
{0, {2, 0, 0}}

(I’m utc+2 currently)

pretty sure elixir doesn’t expose it.. since it’s a very bad path to venture down of.. time is hard enough as it is..

cmo

cmo

Use Timex’s Timezone.local()?

craig

craig

reading timex’s source on how it looks up local time was really informative, they have a lot of sane fallbacks and os-specific lookup methods

Last Post!

DarckBlezzer

DarckBlezzer

I know this post is old but what about this?

I only test this on Ubuntu…
System.shell("timedatectl | grep 'Time zone' | awk '{print $3}'")

Where Next?

Popular in Questions 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
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
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

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
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
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement