News for hackers. Stuff that matters.
Re:It's Time for a Change: Datetime.utcnow() Is Now Deprecated by icholy on Sunday November 19, 2023 @04:33PM (#38338352)
Why can't opening hours be stored in UTC?
Re:It's Time for a Change: Datetime.utcnow() Is Now Deprecated by RichieAHB on Sunday November 19, 2023 @04:39PM (#38338443)
A store’s opening hours will probably remain 9am-5pm regardless of any time zone changes around it. If you run a bunch of stores across time zones you need to know where each store is and whether it’s summer or winter to work backwards to find out 9-5 in UTC.
Re:It's Time for a Change: Datetime.utcnow() Is Now Deprecated by jomoho on Sunday November 19, 2023 @04:37PM (#38338403)
Every heard of daylight savings time (DST)?
Re:It's Time for a Change: Datetime.utcnow() Is Now Deprecated by capableweb on Sunday November 19, 2023 @04:39PM (#38338427)
Can be adjust client-side, or wherever you need to present it, rather than adjusting stored data.
Re:It's Time for a Change: Datetime.utcnow() Is Now Deprecated by mulmen on Sunday November 19, 2023 @04:47PM (#38338542)
This is only sometimes true. Cases like opening hours and daily batch processing rely on local time. Persisting the values in UTC mean best case you are wrong half of the year and worst case all of it.
Re:It's Time for a Change: Datetime.utcnow() Is Now Deprecated by capableweb on Sunday November 19, 2023 @05:17PM (#38338939)
Just because you're storing the time in UTC doesnt mean you can't also store the timezone, and lots of other related data too.
Re:It's Time for a Change: Datetime.utcnow() Is Now Deprecated by mulmen on Sunday November 19, 2023 @05:48PM (#38339322)
6am in my time zone is two different times in UTC. Right now it is 14:00 UTC. But when DST starts it will be 13:00. So what UTC value do you insert into your database for the opening time of the coffee shop? And how do you convert?
Re:It's Time for a Change: Datetime.utcnow() Is Now Deprecated by pjot on Sunday November 19, 2023 @04:37PM (#38338400)
Seems like the ideal way to store them to me!
Re:It's Time for a Change: Datetime.utcnow() Is Now Deprecated by mulmen on Sunday November 19, 2023 @04:48PM (#38338557)
Have you thought about this? How do you store shop hours in UTC for shops in timezones with DST?
Re:It's Time for a Change: Datetime.utcnow() Is Now Deprecated by midasuni on Sunday November 19, 2023 @05:44PM (#38339282)
Then you would be wrong, because they open at 9am local time - if the government changes local time with 2 days notice then opening time changes.
Re:It's Time for a Change: Datetime.utcnow() Is Now Deprecated by mulmen on Sunday November 19, 2023 @04:42PM (#38338481)
The coffee shop in my neighborhood is open from 6am to 2pm Pacific. We observe daylight saving time. The shop hours do not change. So, what UTC value do you store?
Re:It's Time for a Change: Datetime.utcnow() Is Now Deprecated by bilsbie on Sunday November 19, 2023 @05:10PM (#38338852)
I guess it would change based on local time changes.