Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. How did I not know this?

How did I not know this?

Scheduled Pinned Locked Moved The Lounge
csharpjavascriptcloudhelpwinforms
41 Posts 17 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Sander RosselS Sander Rossel

    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

    J Offline
    J Offline
    Jorgen Andersson
    wrote on last edited by
    #28

    How about star dates? :D

    Wrong is evil and must be defeated. - Jeff Ello

    Sander RosselS 1 Reply Last reply
    0
    • Sander RosselS Sander Rossel

      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

      N Offline
      N Offline
      Nelek
      wrote on last edited by
      #29

      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.

      Sander RosselS 1 Reply Last reply
      0
      • D Dan Neely

        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

        N Offline
        N Offline
        Nelek
        wrote on last edited by
        #30

        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.

        1 Reply Last reply
        0
        • J Jorgen Andersson

          How about star dates? :D

          Wrong is evil and must be defeated. - Jeff Ello

          Sander RosselS Offline
          Sander RosselS Offline
          Sander Rossel
          wrote on last edited by
          #31

          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

          1 Reply Last reply
          0
          • N Nelek

            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.

            Sander RosselS Offline
            Sander RosselS Offline
            Sander Rossel
            wrote on last edited by
            #32

            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

            N 1 Reply Last reply
            0
            • Sander RosselS Sander Rossel

              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

              N Offline
              N Offline
              Nelek
              wrote on last edited by
              #33

              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.

              Sander RosselS 1 Reply Last reply
              0
              • N Nelek

                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.

                Sander RosselS Offline
                Sander RosselS Offline
                Sander Rossel
                wrote on last edited by
                #34

                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

                1 Reply Last reply
                0
                • Sander RosselS Sander Rossel

                  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

                  J Offline
                  J Offline
                  JamesRuzinok
                  wrote on last edited by
                  #35

                  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...

                  1 Reply Last reply
                  0
                  • Sander RosselS Sander Rossel

                    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

                    S Offline
                    S Offline
                    StarNamer work
                    wrote on last edited by
                    #36

                    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?

                    Sander RosselS 1 Reply Last reply
                    0
                    • Sander RosselS Sander Rossel

                      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

                      C Offline
                      C Offline
                      Choroid
                      wrote on last edited by
                      #37

                      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

                      Sander RosselS 1 Reply Last reply
                      0
                      • C Choroid

                        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

                        Sander RosselS Offline
                        Sander RosselS Offline
                        Sander Rossel
                        wrote on last edited by
                        #38

                        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

                        1 Reply Last reply
                        0
                        • S StarNamer work

                          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?

                          Sander RosselS Offline
                          Sander RosselS Offline
                          Sander Rossel
                          wrote on last edited by
                          #39

                          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

                          1 Reply Last reply
                          0
                          • Sander RosselS Sander Rossel

                            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

                            F Offline
                            F Offline
                            Fabio Franco
                            wrote on last edited by
                            #40

                            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

                            1 Reply Last reply
                            0
                            • Sander RosselS Sander Rossel

                              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

                              E Offline
                              E Offline
                              englebart
                              wrote on last edited by
                              #41

                              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.

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups