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. I have anxiety now...

I have anxiety now...

Scheduled Pinned Locked Moved The Lounge
javascriptcloudcsharplinqcom
35 Posts 11 Posters 0 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

    The Problem with Time & Timezones - Computerphile - YouTube[^] And yeah, been there done that (luckily not all the exceptions discussed in this video...) :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

    J Offline
    J Offline
    jochance
    wrote on last edited by
    #5

    Even outside time zones it's all hard enough. We are now contending with the slowing of the earth spinning causing days to be ms longer. We'll soon start to contend with time in space, not to be confused with space-time.

    J K 2 Replies Last reply
    0
    • K k5054

      I disagree. At the time, "Railway Time" was an excellent response to the issue where every town had their own idea of what the current time was, which made train scheduling confusing for both the railway companies and the traveling public. Nowadays, though, you should probably store DateTime objects in UTC or Unix-Epoch or some other non-local time format, and convert to local time as needed. I've seen various arguments for doing everything in UTC, but I can't see that as gaining traction. People, being people, are going to want to have solar noon more-or-less match the clock reading 12:00 [Pedantic note: noon is neither AM (Ante-Meridian: before midday) or PM (Post-Meridian: after midday)]. Though maybe that's an old fogey perspective, and it will be like the metric system, with eventually only the US sticking to the old ways.

      "A little song, a little dance, a little seltzer down your pants" Chuckles the clown

      J Offline
      J Offline
      Jeremy Falcon
      wrote on last edited by
      #6

      Totally agree. Well, except I believe that everything should be stored in UTC. Just get used to it already. But, especially before the Internet and globalization, anti-timezone peeps act like not having a timezone would be better. But, just imagine the chaos of morning sunrise happening at 11:00PM. It's just trading one confusion for another. People want to act smart by looking behind them (easy to do) and insulting things. But, I can promise, given the state of the world, most everyone would be agreeing to use them if they were alive and well during that time. IMO daylight savings time did more harm than timezones. Again, I can see why it was created. But, it caused more issues than timezones. Timezones were never really an issue.

      Jeremy Falcon

      K Sander RosselS N 3 Replies Last reply
      0
      • Sander RosselS Sander Rossel

        The Problem with Time & Timezones - Computerphile - YouTube[^] And yeah, been there done that (luckily not all the exceptions discussed in this video...) :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

        J Offline
        J Offline
        Jeremy Falcon
        wrote on last edited by
        #7

        It's a YT video. It's supposed to make things dramatic and conflicted. Any real professional programmer should know how to deal with timezones this day and age. There's no excuse, unless you're an intern or something like that.

        Jeremy Falcon

        L 1 Reply Last reply
        0
        • J jochance

          Even outside time zones it's all hard enough. We are now contending with the slowing of the earth spinning causing days to be ms longer. We'll soon start to contend with time in space, not to be confused with space-time.

          J Offline
          J Offline
          Jeremy Falcon
          wrote on last edited by
          #8

          jochance wrote:

          We are now contending with the slowing of the earth spinning causing days to be ms longer.

          Most people don't realize that. Every year gets a bit longer. It's something like a day getting longer by about 1.8 milliseconds per century, which is something like 657.45 MS (almost a second) every 100 years. So, in the future, we may need a new calendar system to account for it.

          Jeremy Falcon

          1 Reply Last reply
          0
          • K k5054

            I disagree. At the time, "Railway Time" was an excellent response to the issue where every town had their own idea of what the current time was, which made train scheduling confusing for both the railway companies and the traveling public. Nowadays, though, you should probably store DateTime objects in UTC or Unix-Epoch or some other non-local time format, and convert to local time as needed. I've seen various arguments for doing everything in UTC, but I can't see that as gaining traction. People, being people, are going to want to have solar noon more-or-less match the clock reading 12:00 [Pedantic note: noon is neither AM (Ante-Meridian: before midday) or PM (Post-Meridian: after midday)]. Though maybe that's an old fogey perspective, and it will be like the metric system, with eventually only the US sticking to the old ways.

            "A little song, a little dance, a little seltzer down your pants" Chuckles the clown

            L Offline
            L Offline
            lmoelleb
            wrote on last edited by
            #9

            I use DateTimeOffset instead of storing in UTC. Too many things can go wrong in the conversion when using DateTime. I have seen highly experienced developers doing stupid things like DateTime.Now.ToUniversalTime()

            L J K 3 Replies Last reply
            0
            • L lmoelleb

              I use DateTimeOffset instead of storing in UTC. Too many things can go wrong in the conversion when using DateTime. I have seen highly experienced developers doing stupid things like DateTime.Now.ToUniversalTime()

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #10

              Not using UTC because some developers do stupid things, is hardly a great idea.

              L 1 Reply Last reply
              0
              • L Lost User

                Not using UTC because some developers do stupid things, is hardly a great idea.

                L Offline
                L Offline
                lmoelleb
                wrote on last edited by
                #11

                Why would it be better to use DateTime than DateTimeOffset? Edit: and why would you not want to minimize the possibility of doing stupid things?

                L 1 Reply Last reply
                0
                • L lmoelleb

                  Why would it be better to use DateTime than DateTimeOffset? Edit: and why would you not want to minimize the possibility of doing stupid things?

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #12

                  No idea, I never said it was.

                  L 1 Reply Last reply
                  0
                  • L Lost User

                    No idea, I never said it was.

                    L Offline
                    L Offline
                    lmoelleb
                    wrote on last edited by
                    #13

                    You said it was not a great idea? I agree it is hard to clasify as "great", just an extremely simple way to minimize a problem.

                    J L 2 Replies Last reply
                    0
                    • J Jeremy Falcon

                      It's a YT video. It's supposed to make things dramatic and conflicted. Any real professional programmer should know how to deal with timezones this day and age. There's no excuse, unless you're an intern or something like that.

                      Jeremy Falcon

                      L Offline
                      L Offline
                      lmoelleb
                      wrote on last edited by
                      #14

                      Yet I have seen a developer I would clarify as highly competent do "DateTime.Now.ToUniversalTime()". I have seen code break because it did not handle DateTimeKind.Unknown and some upstream code changed. Yes, it is quite simple, yet mistakes happens.

                      J 1 Reply Last reply
                      0
                      • L lmoelleb

                        Yet I have seen a developer I would clarify as highly competent do "DateTime.Now.ToUniversalTime()". I have seen code break because it did not handle DateTimeKind.Unknown and some upstream code changed. Yes, it is quite simple, yet mistakes happens.

                        J Offline
                        J Offline
                        Jeremy Falcon
                        wrote on last edited by
                        #15

                        lmoelleb wrote:

                        Yet I have seen a developer I would clarify as highly competent do "DateTime.Now.ToUniversalTime()".

                        That in and of itself isn't bad. It would be context dependent as to whether that's bad or not.

                        lmoelleb wrote:

                        Yes, it is quite simple, yet mistakes happens.

                        For sure, but it's not as bad as some would suggest. I'd argue dealing with OS API compatibility or browser compatibly issues are far more involved (well not as much as it used to be).

                        Jeremy Falcon

                        L 1 Reply Last reply
                        0
                        • L lmoelleb

                          I use DateTimeOffset instead of storing in UTC. Too many things can go wrong in the conversion when using DateTime. I have seen highly experienced developers doing stupid things like DateTime.Now.ToUniversalTime()

                          J Offline
                          J Offline
                          Jeremy Falcon
                          wrote on last edited by
                          #16

                          lmoelleb wrote:

                          I use DateTimeOffset instead of storing in UTC.

                          I don't do .NET these days, but would that not use the same conversions internally to figure out the offset? So, what's the advantage over just converting to UTC and sticking with it?

                          Jeremy Falcon

                          L 1 Reply Last reply
                          0
                          • L lmoelleb

                            You said it was not a great idea? I agree it is hard to clasify as "great", just an extremely simple way to minimize a problem.

                            J Offline
                            J Offline
                            Jeremy Falcon
                            wrote on last edited by
                            #17

                            Storing local times for any application is a bad idea. I'm sure Richard is just speaking from experience.

                            Jeremy Falcon

                            L 1 Reply Last reply
                            0
                            • L lmoelleb

                              I use DateTimeOffset instead of storing in UTC. Too many things can go wrong in the conversion when using DateTime. I have seen highly experienced developers doing stupid things like DateTime.Now.ToUniversalTime()

                              K Offline
                              K Offline
                              k5054
                              wrote on last edited by
                              #18

                              I was using DateTime in a generic way, meaning an object that expresses a point in time, whether a Database object, program variable or datum in a flat file. I did not intend to refer to any specific version of a Date/Time object.

                              "A little song, a little dance, a little seltzer down your pants" Chuckles the clown

                              1 Reply Last reply
                              0
                              • J Jeremy Falcon

                                Totally agree. Well, except I believe that everything should be stored in UTC. Just get used to it already. But, especially before the Internet and globalization, anti-timezone peeps act like not having a timezone would be better. But, just imagine the chaos of morning sunrise happening at 11:00PM. It's just trading one confusion for another. People want to act smart by looking behind them (easy to do) and insulting things. But, I can promise, given the state of the world, most everyone would be agreeing to use them if they were alive and well during that time. IMO daylight savings time did more harm than timezones. Again, I can see why it was created. But, it caused more issues than timezones. Timezones were never really an issue.

                                Jeremy Falcon

                                K Offline
                                K Offline
                                k5054
                                wrote on last edited by
                                #19

                                Jeremy Falcon wrote:

                                everything should be stored in UTC

                                I've been using Unix Epoch (seconds since Jan 1, 1970 UTC+0) i.e. a time_t to store most times since the late 80's. Which is the same idea. It represents a fixed moment in time, and what semantic interpretation is up to any locale information that's active at any given moment.

                                "A little song, a little dance, a little seltzer down your pants" Chuckles the clown

                                1 Reply Last reply
                                0
                                • J jochance

                                  Even outside time zones it's all hard enough. We are now contending with the slowing of the earth spinning causing days to be ms longer. We'll soon start to contend with time in space, not to be confused with space-time.

                                  K Offline
                                  K Offline
                                  k5054
                                  wrote on last edited by
                                  #20

                                  jochance wrote:

                                  We'll soon start to contend with time in space, not to be confused with space-time.

                                  [A moon time zone? Why NASA is racing to set one.](https://www.usatoday.com/story/graphics/2024/04/23/why-moon-time-zone-is-needed/73288518007/#:~:text=On Earth%2C Coordinated Universal Time,one or multiple time zones.)

                                  "A little song, a little dance, a little seltzer down your pants" Chuckles the clown

                                  1 Reply Last reply
                                  0
                                  • L lmoelleb

                                    You said it was not a great idea? I agree it is hard to clasify as "great", just an extremely simple way to minimize a problem.

                                    L Offline
                                    L Offline
                                    Lost User
                                    wrote on last edited by
                                    #21

                                    No, what I actually said was

                                    Quote:

                                    Not using UTC because some developers do stupid things, is hardly a great idea.

                                    .My point being that to do, or not do, something because some other developer may make a mistake, or do something stupid, is not really good decision making. It was not meant to be specific to DateTime or DateTimeOffset.

                                    L 1 Reply Last reply
                                    0
                                    • J Jeremy Falcon

                                      Storing local times for any application is a bad idea. I'm sure Richard is just speaking from experience.

                                      Jeremy Falcon

                                      L Offline
                                      L Offline
                                      lmoelleb
                                      wrote on last edited by
                                      #22

                                      Why would it be a bad idea to store DateTimeOffset? The way to store date/time I have the most experience with is DateTime stored as UTC. But I see no reason to go back to that - what is the benefit?

                                      J 1 Reply Last reply
                                      0
                                      • L Lost User

                                        No, what I actually said was

                                        Quote:

                                        Not using UTC because some developers do stupid things, is hardly a great idea.

                                        .My point being that to do, or not do, something because some other developer may make a mistake, or do something stupid, is not really good decision making. It was not meant to be specific to DateTime or DateTimeOffset.

                                        L Offline
                                        L Offline
                                        lmoelleb
                                        wrote on last edited by
                                        #23

                                        Oh, that is clearer then. Funnily enough I can't really find any better reason to make a decision than avoiding developers making mistakes.

                                        1 Reply Last reply
                                        0
                                        • J Jeremy Falcon

                                          lmoelleb wrote:

                                          I use DateTimeOffset instead of storing in UTC.

                                          I don't do .NET these days, but would that not use the same conversions internally to figure out the offset? So, what's the advantage over just converting to UTC and sticking with it?

                                          Jeremy Falcon

                                          L Offline
                                          L Offline
                                          lmoelleb
                                          wrote on last edited by
                                          #24

                                          The main advantage is that it natively protect against mistakes. It does not use the same logic internally as DateTime - it stores the offset instead of DateTimeKind. You never have to deal with DateTimeKind.Unknown (primary reason for mistakes I have seen). You never have some database layer having to be told if it is local time or utc. If some idiot use local time... Then nothing happens because it still accurately represents a unique point in time - no matter where in the world that local time was used.

                                          J 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