by OtterCoder · 9y ago · 0 comments
If I have a meeting every day at 10am local time with someone in Arizona, their meeting suddenly jumps by an hour when my time changes. (Similarly, if it's my Arizonian colleagues who set the meeting to be at 10am daily, I'm suddenly meeting them at 11am my time once spring hits.)
(Date)Times stored in the schedule (start times, end times, trigger times, clock times) are not instants in UTC, they are time specification in a calendar system which can only be interpreted as specific instants in the context of a particular time zone. Which is stored explicitly and separately from the calendar date-times.
This crucial separation of a time specifications in a calendar system from instants in time is one thing which many date/time libraries get wrong and which Noda-/JodaTime gets right.
As for how you should store times, yes you should always store time as UTC. This is a different problem.
It's specific times you want UTC, if I setup a meeting then I want someone in another time zone to call in at the same time.
Your example may work fine on a server that you control, but let's say your use case is a phone alarm program. You can't guarantee that your application will know when it's 7:30AM in the local time, but you can guarantee what the time is in UTC and not need network or the device's help to do it.
So now the time format you store depends on the architecture of your platform? What if you have to send this data between platforms now? Am I going to have to convert back and forth for each message? No thanks. I'll just store everything as UTC and stay sane.
You are either in DST or not - that's why we have PST and PDT - one is a daylight time and reflects a different offset from standard.
Most people are in the same timezone but when not, it's the responsibility of the attendee to know that it's shifted - and the calendaring system should know to update it accordingly.