IMO every datetime should be in utc, and variables for datetimes should either be suffixed “Utc” or have a type indicating their time zone (DateTimeOffset or UtcDateTime etc). Conversion to local time happens at the last possible second (e.g. in the view model or an outbound http request parameter). Of course that doesn’t solve the problem of interoperating with other morons programmers who don’t follow these rules, but it keeps things a lot neater locally.
Scheduling based on regional time conventions (holidays, weekends, etc) is just not great though.
Throwing UTC everywhere doesn’t solve comparisons around leap seconds. I’m sure they’re other issues with this method, but this is kinda the point of “just use a library”. Then it’s someone else’s problem.
I’m a .NET dev, I don’t have a concept of “just use a library.” Everything is a library. I don’t mean “using int for datetimes is ok as long as you label it utc,” I just mean “don’t deal with time zones.”
Unix is the easiest format I’ve used. It’s easy to parse, it’s consistent, there’s not usually competing unix like formats, it converts perfectly to other time formats, most file explorers can immediately sort it correctly, and it’s clearly the date from which the universe spawned into existence.
I also really like the Bitcoin block number. It will likely be one of the most provable records of time passing, but not as convienent for tracking or converting time.
IMO every datetime should be in utc, and variables for datetimes should either be suffixed “Utc” or have a type indicating their time zone (DateTimeOffset or UtcDateTime etc). Conversion to local time happens at the last possible second (e.g. in the view model or an outbound http request parameter). Of course that doesn’t solve the problem of interoperating with other
moronsprogrammers who don’t follow these rules, but it keeps things a lot neater locally.Scheduling based on regional time conventions (holidays, weekends, etc) is just not great though.
Throwing UTC everywhere doesn’t solve comparisons around leap seconds. I’m sure they’re other issues with this method, but this is kinda the point of “just use a library”. Then it’s someone else’s problem.
I’m a .NET dev, I don’t have a concept of “just use a library.” Everything is a library. I don’t mean “using int for datetimes is ok as long as you label it utc,” I just mean “don’t deal with time zones.”
Unix is the easiest format I’ve used. It’s easy to parse, it’s consistent, there’s not usually competing unix like formats, it converts perfectly to other time formats, most file explorers can immediately sort it correctly, and it’s clearly the date from which the universe spawned into existence.
It’s alright, but real programmers use Julian UTC.
I also really like the Bitcoin block number. It will likely be one of the most provable records of time passing, but not as convienent for tracking or converting time.