travisf
I’m sending a daily report which should be showing the current time set to mountain daylight time. However, after daylight savings time the report has been consistently an hour behind. I if I run Timex.now("MDT") in the terminal I will get the current time in MDT. Our report is generated much the same way: {:ok, date} = Timex.format(Timex.now("MDT"), "{h12}:{m} {am}") Again, this works in my terminal but not on the report that gets sent out; it’s an hour behind.
However, if I change Timex.now("EST") I will get Eastern Time but an hour behind (right now it’s 11:15 EST but I’m getting 10:15).
Any ideas on what the cause of this might be? Is there a Phoenix config somewhere that sets time?
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Hello,
I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter).
The diffic...
New
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
I think I’ve found a small improvement I could contribute to <%= web_namespace %>.CoreComponents (installer/templates/phx_web/compo...
New
Other Trending Topics
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
ICal is a library for interacting with iCalendar data. It parses iCalendars into typed Elixir structs via ICal.from_ics, and can prepare ...
New
Latest Phoenix Threads
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
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #phoenix_html
- #elixirconf-us
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
dimitarvp
Maybe the production deployment server doesn’t have daylight savings enabled?
Do you have access to it? Can you test with the usual UNIX commands on the terminal?
travisf
I can test that for sure, but this happens locally too. If I send the report in a development environment it will be an hour behind.
thojanssens1
If I understand correctly, you have a different result for that instruction in your app and in your local terminal?
My approach would be to identify what is different.
I can see potentially two things when calling
Timex.now/1(never used the lib but had a quick look at its code).:os.system_time()tzdatalib.Would you be able to, once from the app and once from your local terminal, check the output of
:os.system_time()andTzdata.version()?dimitarvp
Then maybe your local and production DBs don’t have the daylight savings activated? Just shooting in the dark, it’s the first good assumption I could make.
travisf
I think I’ve realized the issue. Our code was actually using
Timex.now("MST")I thoughtMSTandMDTwere interchangeable or that Timex would account for daylight saving time. It seems likeMSTwill be incorrect about 8 months out of the year, I can’t verifyMDTseems likeAmerica/Denveris the way to go.@dimitarvp your daylight savings mention got me on this track.
thojanssens1
“MST” used as a time zone ID has a constant offset of -7 hours from UTC for the whole year. It’s not a bug. It’s a rule written in the IANA time zone database.
“America/Denver” is a time zone ID and MST/MDT are abbreviations for that time zone.
travisf
I didn’t say it’s a bug, when I said “incorrect” I just meant in the case where we had used it to display text on an email. You mention the offset for MST, is MDT then going to be -6 hours from UTC for the whole year as well?
thojanssens1
I think I confuse you more:) but the IANA tz database can be very confusing.
“MST” can be used as a time zone ID; but for example “MDT” seems not to be a valid time zone ID.
^ So this should actually throw an error
Anyway, this is not what you want. You want to use “America/Denver” as a time zone ID.
When you use “America/Denver” as a time zone ID, the offset will change throughout the year:
-07:00/MST and -06:00/MDT
travisf
It doesn’t throw an error, it just gives the current time (since we are in daylight time). But I am now using “America/Denver” as the time zone ID for much of the app. Thanks @thojanssens1.
LostKobrakai
This is actually how timezones work. Timezone names alike MDT are names for certain UTC offsets. Area names like “America/Denver” are the names, which define which of those timezones is in effect in a certain area of the world at a certain time.