How did I not know this?
-
I posted an alternative to timezones in another reply in this thread.
Sander Rossel wrote:
I have an alternative, just do away with all time zones, everyone is always living at the same time. Instead, some people would wake up at 15:00 and go to bed at 07:00 while others are awake from 08:00 to 24:00. If someone says "can we schedule a meeting at 10:00?" a person on the other side of the world would immediately know if they're asleep at that time or not. So instead of learning time zones you really just have to know a country's working hours.
I think such a system would make programmers all around the globe very happy :D And managers very sad, since date and time issues now take minutes to solve instead of months costing them sweet €€€ :D
Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript
How about star dates? :D
Wrong is evil and must be defeated. - Jeff Ello
-
Nelek wrote:
save data in UTC. Show data / interact with user in local.
Actually, I just got the requirements back... Save and show everything in just one date only, that of HQ :laugh:
Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript
Well... if it is an "order" and it is written... they pay, they rule.
M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.
-
Nelek wrote:
Didn't you know about DateTime.ToLocalTime Method (System) | Microsoft Docs[^] ?
That's a giant trap if you're doing web work because it puts data in whatever is the servers timezone not the users - which can be especially fun if the hosting provider has the server running on UTC rather than the datacenter local TZ.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius
Fair enough.
M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.
-
How about star dates? :D
Wrong is evil and must be defeated. - Jeff Ello
No, even Hollywood gets the same time as everyone else :~
Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript
-
Well... if it is an "order" and it is written... they pay, they rule.
M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.
My thoughts exactly and pretty much my company motto! :laugh:
Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript
-
My thoughts exactly and pretty much my company motto! :laugh:
Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript
Offtopic... why did you remove the c# succintly link from your signature? I found it not that bad, that you should be ashamed of it ;P :-D
M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.
-
Offtopic... why did you remove the c# succintly link from your signature? I found it not that bad, that you should be ashamed of it ;P :-D
M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.
To make room for my newer Azure books ;)
Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript
-
Can't CEDT or WEDT change? Like we're now talking about dropping summer time in The Netherlands/Europe? You'd at least need a date to get it correct. You wouldn't have this issue if you stored UTC and time difference separately (you'd always know the time as it was when the user left/arrived, which would be UTC + difference and you can always go from UTC to anything else).
Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript
When the timezone data changes there is a corresponding OS level change that will handle it and it know at what point the DST was dropped. So calculations will know if it was in effect or not. It's not rocket science...
-
I posted an alternative to timezones in another reply in this thread.
Sander Rossel wrote:
I have an alternative, just do away with all time zones, everyone is always living at the same time. Instead, some people would wake up at 15:00 and go to bed at 07:00 while others are awake from 08:00 to 24:00. If someone says "can we schedule a meeting at 10:00?" a person on the other side of the world would immediately know if they're asleep at that time or not. So instead of learning time zones you really just have to know a country's working hours.
I think such a system would make programmers all around the globe very happy :D And managers very sad, since date and time issues now take minutes to solve instead of months costing them sweet €€€ :D
Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript
Just imagine the political arguments over who gets their time as THE time! Also, would people be able to cope with the date changing in the middle of the working day?
-
So I'm working on an Azure app and one thing I do (and have done for 11 years now) is use
DateTime.Now
, which gives me the current system date and time. Never been an issue with WinForms apps or locally hosted apps. It's even never been an issue in web apps where I've used it for logging and the like. I've had to use specific time zones before, but always the user's client time zone. In this particular case, I need to save the system/company date and time and also report this back to the user. Azure uses UTC and I'm in The Netherlands though, so the time is always off by one or two hours (depending on summer or winter). The fix, apparently, is this:var timeZone = TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time");
var now = TimeZoneInfo.ConvertTime(DateTime.UtcNow, timeZone);The "W. Europe Standard Time" is a bit of a magical string that will probably change in a few years when we're abolishing summer time (so make it a setting and don't hard code it!). You can get a list of these magical strings using tzutil /l (on Windows). I've always known DateTime.Now isn't really safe or anything, it's just never been an issue until now. DateTime.Today is specific and accurate enough for almost everything I do. And so I've learned how to get the date and time for a specific timezone after 11 years of programming :)
Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript
Here is real time programming nightmare Arizona does not deal with daylight savings time but that is not the issue The Navajo Nation honors the concept of daylight savings time AND the Hopi Nation which sits in the middle of the Navajo Nation does not honor the concept of daylight savings time I have often wondered how you would code for this ? In one town if you cross the street you lose or gain an hour
-
Here is real time programming nightmare Arizona does not deal with daylight savings time but that is not the issue The Navajo Nation honors the concept of daylight savings time AND the Hopi Nation which sits in the middle of the Navajo Nation does not honor the concept of daylight savings time I have often wondered how you would code for this ? In one town if you cross the street you lose or gain an hour
Wow, I did not know that :wtf: Also, did you know 30 and 45 minute time zones exist? They're (whoever they are) are not making this easy for us :sigh:
Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript
-
Just imagine the political arguments over who gets their time as THE time! Also, would people be able to cope with the date changing in the middle of the working day?
StarNamer_ wrote:
Just imagine the political arguments over who gets their time as THE time!
Yeah, it probably couldn't be done because people are trash (personally, I'd say we all go to UTC).
StarNamer_ wrote:
Also, would people be able to cope with the date changing in the middle of the working day?
Maybe you could slide into it, like shift one hour each month. Now THAT would be hell to put into systems, but at least it's only for a year (and shorter for most regions) :D
Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript
-
This user came back from a vacation in Turkey. They probably stopped right across the border to tank some gas or get a sandwich, I don't know. I do know this user filed a bug because he arrived earlier than he left, which could never be correct. The concept of time zone was obviously lost on him as we had to explain to him that he crossed it :sigh: (Or more likely, he saw the times a week later and simply didn't think about it.)
Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript
I don't remember exactly which solution did this right to me, but I think it was google calendar. The way it handled it was that when I travelled, it detected I was in a different time zone than of where the event was registered and showed a hint saying that the event was registered in a different timezone and displayed the time of that timezone along the time on my current timezone. For that to be possible not only you save the UTC value of the event, but the also the timezone of the location when it happened. Then with the current timezone you can do all types UX improvement for this type of scenario, without cluttering it when it's not necessary.
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia
-
So I'm working on an Azure app and one thing I do (and have done for 11 years now) is use
DateTime.Now
, which gives me the current system date and time. Never been an issue with WinForms apps or locally hosted apps. It's even never been an issue in web apps where I've used it for logging and the like. I've had to use specific time zones before, but always the user's client time zone. In this particular case, I need to save the system/company date and time and also report this back to the user. Azure uses UTC and I'm in The Netherlands though, so the time is always off by one or two hours (depending on summer or winter). The fix, apparently, is this:var timeZone = TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time");
var now = TimeZoneInfo.ConvertTime(DateTime.UtcNow, timeZone);The "W. Europe Standard Time" is a bit of a magical string that will probably change in a few years when we're abolishing summer time (so make it a setting and don't hard code it!). You can get a list of these magical strings using tzutil /l (on Windows). I've always known DateTime.Now isn't really safe or anything, it's just never been an issue until now. DateTime.Today is specific and accurate enough for almost everything I do. And so I've learned how to get the date and time for a specific timezone after 11 years of programming :)
Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript
The same thing happens in Windows Explorer with DST. A file is changed at 10 AM standard time the Friday before DST changes. If you check the time stamp on Monday it will display an hour difference. File times are UTC-ish, it is the display time zone that changes. This was Win 7 behavior; I have not verified in Win 10.