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. Bug of the Day

Bug of the Day

Scheduled Pinned Locked Moved The Lounge
databasedebuggingjsonhelp
39 Posts 19 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.
  • C Offline
    C Offline
    Chris Maunder
    wrote on last edited by
    #1

    I'm trying to set a value to the maximum smalldatetime allowed in SQL, yet what's appearing is "6 June 1979". Nothing I do seems to work: ensuring Culture is OK, ensuring I'm passing dates around in a sensible format, ensuring the data I'm setting is the actual date I'm setting. In the debugger I see _date with a value of "6/06/2079 12:00:00 AM" (see rant below). The date is fine. I pass this into a formatter to turn it into "dd-MMM-yy" format. That works perfectly and the output is correct. This string goes to the user, they hit submit, it comes back and is parsed fine. Everything works perfectly. Except the date always comes back as 1979. ARGH. And then I spot it. 15 years too late I've been hit by the Y2K bug. 6/06/2079 12:00:00 AM is 6 Jun 2079 -> "6-Jun-79" which is parsed as 6-Jun-1979. /more coffee, then better formatting. As a side note: The American date format (mm/dd/yyyy) is painfully and dangerously ambiguous so given that OS installs are often set with US as the region, surely debuggers should display dates and times as dd-MMM-yyyy or even better, yyyy-mm-dd to account for the Rest Of The World who wants to scream everytime they get an email saying "the date is 4/7/2015".

    cheers Chris Maunder

    L A T I S 6 Replies Last reply
    0
    • C Chris Maunder

      I'm trying to set a value to the maximum smalldatetime allowed in SQL, yet what's appearing is "6 June 1979". Nothing I do seems to work: ensuring Culture is OK, ensuring I'm passing dates around in a sensible format, ensuring the data I'm setting is the actual date I'm setting. In the debugger I see _date with a value of "6/06/2079 12:00:00 AM" (see rant below). The date is fine. I pass this into a formatter to turn it into "dd-MMM-yy" format. That works perfectly and the output is correct. This string goes to the user, they hit submit, it comes back and is parsed fine. Everything works perfectly. Except the date always comes back as 1979. ARGH. And then I spot it. 15 years too late I've been hit by the Y2K bug. 6/06/2079 12:00:00 AM is 6 Jun 2079 -> "6-Jun-79" which is parsed as 6-Jun-1979. /more coffee, then better formatting. As a side note: The American date format (mm/dd/yyyy) is painfully and dangerously ambiguous so given that OS installs are often set with US as the region, surely debuggers should display dates and times as dd-MMM-yyyy or even better, yyyy-mm-dd to account for the Rest Of The World who wants to scream everytime they get an email saying "the date is 4/7/2015".

      cheers Chris Maunder

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

      The American date format of MM/DD/YYYY is simply idiotic, as is our ridiculous clinging to Imperial measurements, when the metric system makes so much more sense. Why? I believe we Americans are just too lazy to adapt to a new system, despite the fact that it just makes sense to do so! OK, I have my coat and am long gone! ;P

      How do we preserve the wisdom men will need, when their violent passions are spent? - The Lost Horizon

      9 C L W 5 Replies Last reply
      0
      • L Lost User

        The American date format of MM/DD/YYYY is simply idiotic, as is our ridiculous clinging to Imperial measurements, when the metric system makes so much more sense. Why? I believe we Americans are just too lazy to adapt to a new system, despite the fact that it just makes sense to do so! OK, I have my coat and am long gone! ;P

        How do we preserve the wisdom men will need, when their violent passions are spent? - The Lost Horizon

        9 Offline
        9 Offline
        9082365
        wrote on last edited by
        #3

        How does the metric system make more sense? It's no less arbitrary and the assumption that people will find the arithmetic less difficult is highly doubtful (shortly after we decimalised currency in the UK I was delayed by several minutes in a shop because the assistant needed to fetch a calculator to work out a 10% discount!) The imperial weights fit particularly well with the quantities of things that people might want to buy - I know exactly what I'm getting in a quarter of mushrooms, an ounce of yeast or a pound of mince and so that's what I continue to ask for despite the EU's attempts to homogenise us all with baffling amounts. Long live the pound, the pint and the mile, I say. And to return the date. It is of course the departure from the Imperial norm made by Americans (when and why I have yet to discover) that causes all the problems. Who else could come up with a system that takes a unit from its rightful place in between the lower and the higher and sticks it at the front? You don't do mm:hh:ss so why MM:dd:yy Bewildering!

        R L M R 7 Replies Last reply
        0
        • 9 9082365

          How does the metric system make more sense? It's no less arbitrary and the assumption that people will find the arithmetic less difficult is highly doubtful (shortly after we decimalised currency in the UK I was delayed by several minutes in a shop because the assistant needed to fetch a calculator to work out a 10% discount!) The imperial weights fit particularly well with the quantities of things that people might want to buy - I know exactly what I'm getting in a quarter of mushrooms, an ounce of yeast or a pound of mince and so that's what I continue to ask for despite the EU's attempts to homogenise us all with baffling amounts. Long live the pound, the pint and the mile, I say. And to return the date. It is of course the departure from the Imperial norm made by Americans (when and why I have yet to discover) that causes all the problems. Who else could come up with a system that takes a unit from its rightful place in between the lower and the higher and sticks it at the front? You don't do mm:hh:ss so why MM:dd:yy Bewildering!

          R Offline
          R Offline
          R Giskard Reventlov
          wrote on last edited by
          #4

          I believe the US Navy uses dd/MM/yyyy. Of course, the correct usage should be yyyyMMdd. No ambiguity there at all. Long live Imperial! :-)

          A 1 Reply Last reply
          0
          • L Lost User

            The American date format of MM/DD/YYYY is simply idiotic, as is our ridiculous clinging to Imperial measurements, when the metric system makes so much more sense. Why? I believe we Americans are just too lazy to adapt to a new system, despite the fact that it just makes sense to do so! OK, I have my coat and am long gone! ;P

            How do we preserve the wisdom men will need, when their violent passions are spent? - The Lost Horizon

            C Offline
            C Offline
            Colin Mullikin
            wrote on last edited by
            #5

            As far as date is concerned, I prefer the "July 22, 2015" format. There is no room for ambiguity. However, when it comes to Imperial v. Metric. I am strictly in the Metric for science, Imperial for every day use camp. For instance, I have an intuition for how far a mile is, or how much a 50lb bag of sand weighs, but I have no clue how far a kilometer is or how much a 50kg bag of sand might weigh. Yes, I know what the conversion factors are, but I have to think about it, then convert to Imperial, just so I can be in the right ballpark. You could say, "Oh, well to Hell with current adults, we should do it for the children." But that creates a problem, because then you have two generations, who are in close proximity (parent/child relationships), using two different systems, and if the Common Core Math standards have taught us anything, it's that parents get really pissed when they're too stubborn and/or stupid to learn how to do their children's math homework.

            The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin

            L V 2 Replies Last reply
            0
            • L Lost User

              The American date format of MM/DD/YYYY is simply idiotic, as is our ridiculous clinging to Imperial measurements, when the metric system makes so much more sense. Why? I believe we Americans are just too lazy to adapt to a new system, despite the fact that it just makes sense to do so! OK, I have my coat and am long gone! ;P

              How do we preserve the wisdom men will need, when their violent passions are spent? - The Lost Horizon

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

              Neither imperial nor metrics system makes sense. Check the very basic physics for this ;)

              L 1 Reply Last reply
              0
              • 9 9082365

                How does the metric system make more sense? It's no less arbitrary and the assumption that people will find the arithmetic less difficult is highly doubtful (shortly after we decimalised currency in the UK I was delayed by several minutes in a shop because the assistant needed to fetch a calculator to work out a 10% discount!) The imperial weights fit particularly well with the quantities of things that people might want to buy - I know exactly what I'm getting in a quarter of mushrooms, an ounce of yeast or a pound of mince and so that's what I continue to ask for despite the EU's attempts to homogenise us all with baffling amounts. Long live the pound, the pint and the mile, I say. And to return the date. It is of course the departure from the Imperial norm made by Americans (when and why I have yet to discover) that causes all the problems. Who else could come up with a system that takes a unit from its rightful place in between the lower and the higher and sticks it at the front? You don't do mm:hh:ss so why MM:dd:yy Bewildering!

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

                Neither imperial nor metrics system makes sense. Check the very basic physics for this ;)

                D 1 Reply Last reply
                0
                • C Chris Maunder

                  I'm trying to set a value to the maximum smalldatetime allowed in SQL, yet what's appearing is "6 June 1979". Nothing I do seems to work: ensuring Culture is OK, ensuring I'm passing dates around in a sensible format, ensuring the data I'm setting is the actual date I'm setting. In the debugger I see _date with a value of "6/06/2079 12:00:00 AM" (see rant below). The date is fine. I pass this into a formatter to turn it into "dd-MMM-yy" format. That works perfectly and the output is correct. This string goes to the user, they hit submit, it comes back and is parsed fine. Everything works perfectly. Except the date always comes back as 1979. ARGH. And then I spot it. 15 years too late I've been hit by the Y2K bug. 6/06/2079 12:00:00 AM is 6 Jun 2079 -> "6-Jun-79" which is parsed as 6-Jun-1979. /more coffee, then better formatting. As a side note: The American date format (mm/dd/yyyy) is painfully and dangerously ambiguous so given that OS installs are often set with US as the region, surely debuggers should display dates and times as dd-MMM-yyyy or even better, yyyy-mm-dd to account for the Rest Of The World who wants to scream everytime they get an email saying "the date is 4/7/2015".

                  cheers Chris Maunder

                  A Offline
                  A Offline
                  Afzaal Ahmad Zeeshan
                  wrote on last edited by
                  #8

                  Or at least should provide a separate option of, IsAfterY2K to make it clear as to which one to use. ;-) I also am of view that dates should be in format, "date/month/year" and I try to use full year notation, 2015 instead of short form of 15 or 15' etc. Helps me everytime. :-) Anyways, title should be "Bug of the Y2K"! :laugh: There is a pun in it. ;)

                  The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

                  1 Reply Last reply
                  0
                  • R R Giskard Reventlov

                    I believe the US Navy uses dd/MM/yyyy. Of course, the correct usage should be yyyyMMdd. No ambiguity there at all. Long live Imperial! :-)

                    A Offline
                    A Offline
                    Afzaal Ahmad Zeeshan
                    wrote on last edited by
                    #9

                    True, and year should be yyyy, not yy only. :)

                    The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

                    1 Reply Last reply
                    0
                    • L Lost User

                      The American date format of MM/DD/YYYY is simply idiotic, as is our ridiculous clinging to Imperial measurements, when the metric system makes so much more sense. Why? I believe we Americans are just too lazy to adapt to a new system, despite the fact that it just makes sense to do so! OK, I have my coat and am long gone! ;P

                      How do we preserve the wisdom men will need, when their violent passions are spent? - The Lost Horizon

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

                      Americans are adopting the metric system... inch by inch! ;P

                      Contrary to popular belief, nobody owes you anything.

                      L 1 Reply Last reply
                      0
                      • 9 9082365

                        How does the metric system make more sense? It's no less arbitrary and the assumption that people will find the arithmetic less difficult is highly doubtful (shortly after we decimalised currency in the UK I was delayed by several minutes in a shop because the assistant needed to fetch a calculator to work out a 10% discount!) The imperial weights fit particularly well with the quantities of things that people might want to buy - I know exactly what I'm getting in a quarter of mushrooms, an ounce of yeast or a pound of mince and so that's what I continue to ask for despite the EU's attempts to homogenise us all with baffling amounts. Long live the pound, the pint and the mile, I say. And to return the date. It is of course the departure from the Imperial norm made by Americans (when and why I have yet to discover) that causes all the problems. Who else could come up with a system that takes a unit from its rightful place in between the lower and the higher and sticks it at the front? You don't do mm:hh:ss so why MM:dd:yy Bewildering!

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

                        I lived through the transition from the imperial system to the metric system in South Africa so I do have some experience in both systems. As far as I am concerned there is no choice: Metric is head and shoulders better than imperial! I also experienced the transition of the monetary system from pounds/shillings/pence to the current metric equivalent in SA and the UK. In SA the transition was overnight. Pounds were withdrawn from circulation in a matter of days. In the UK it took months as they chose to run a dual system for months. Very painful! Nobody will ever convince me that imperial is better!

                        How do we preserve the wisdom men will need, when their violent passions are spent? - The Lost Horizon

                        H J 2 Replies Last reply
                        0
                        • L Lost User

                          Americans are adopting the metric system... inch by inch! ;P

                          Contrary to popular belief, nobody owes you anything.

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

                          Very funny! :-D

                          How do we preserve the wisdom men will need, when their violent passions are spent? - The Lost Horizon

                          1 Reply Last reply
                          0
                          • L Lost User

                            Neither imperial nor metrics system makes sense. Check the very basic physics for this ;)

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

                            Please elaborate - I don't get your point. :confused:

                            How do we preserve the wisdom men will need, when their violent passions are spent? - The Lost Horizon

                            1 Reply Last reply
                            0
                            • C Chris Maunder

                              I'm trying to set a value to the maximum smalldatetime allowed in SQL, yet what's appearing is "6 June 1979". Nothing I do seems to work: ensuring Culture is OK, ensuring I'm passing dates around in a sensible format, ensuring the data I'm setting is the actual date I'm setting. In the debugger I see _date with a value of "6/06/2079 12:00:00 AM" (see rant below). The date is fine. I pass this into a formatter to turn it into "dd-MMM-yy" format. That works perfectly and the output is correct. This string goes to the user, they hit submit, it comes back and is parsed fine. Everything works perfectly. Except the date always comes back as 1979. ARGH. And then I spot it. 15 years too late I've been hit by the Y2K bug. 6/06/2079 12:00:00 AM is 6 Jun 2079 -> "6-Jun-79" which is parsed as 6-Jun-1979. /more coffee, then better formatting. As a side note: The American date format (mm/dd/yyyy) is painfully and dangerously ambiguous so given that OS installs are often set with US as the region, surely debuggers should display dates and times as dd-MMM-yyyy or even better, yyyy-mm-dd to account for the Rest Of The World who wants to scream everytime they get an email saying "the date is 4/7/2015".

                              cheers Chris Maunder

                              T Offline
                              T Offline
                              Tim Carmichael
                              wrote on last edited by
                              #14

                              Grew up with the imperial system, in grade 7 or so when metric was introduced, so I've used both. For dates? I write out the date, as in July 22, 2015 - no ambiguity. This is probably the format that gave rise to mm/dd/yy.

                              1 Reply Last reply
                              0
                              • L Lost User

                                I lived through the transition from the imperial system to the metric system in South Africa so I do have some experience in both systems. As far as I am concerned there is no choice: Metric is head and shoulders better than imperial! I also experienced the transition of the monetary system from pounds/shillings/pence to the current metric equivalent in SA and the UK. In SA the transition was overnight. Pounds were withdrawn from circulation in a matter of days. In the UK it took months as they chose to run a dual system for months. Very painful! Nobody will ever convince me that imperial is better!

                                How do we preserve the wisdom men will need, when their violent passions are spent? - The Lost Horizon

                                H Offline
                                H Offline
                                H Brydon
                                wrote on last edited by
                                #15

                                Cornelius Henning wrote:

                                I lived through the transition from the imperial system to the metric system in South Africa so I do have some experience in both systems. As far as I am concerned there is no choice: Metric is head and shoulders better than imperial!

                                I likewise lived through the transition in Canada, and agree that metric is better than Imperial or US. One exception though: the country was surveyed in chains, yards, feet and inches, and changing "travelling" distances to metric was a bad idea. Anything that was in round numbers when surveyed, bought or sold is now in fractional units (meters, hectares, ...) and this is nothing less than a mess.

                                I'm retired. There's a nap for that... - Harvey

                                1 Reply Last reply
                                0
                                • L Lost User

                                  Neither imperial nor metrics system makes sense. Check the very basic physics for this ;)

                                  D Offline
                                  D Offline
                                  Daniel Pfeffer
                                  wrote on last edited by
                                  #16

                                  0x01AA wrote:

                                  Check the very basic physics for this

                                  Yup. We should measure speeds in fractions of the speed of light, time as a multiple of a basic physical frequency, and distance at the distance travelled by light in a time unit. Come to think of it, that's how the meter and second are defined!

                                  If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack. --Winston Churchill

                                  1 Reply Last reply
                                  0
                                  • 9 9082365

                                    How does the metric system make more sense? It's no less arbitrary and the assumption that people will find the arithmetic less difficult is highly doubtful (shortly after we decimalised currency in the UK I was delayed by several minutes in a shop because the assistant needed to fetch a calculator to work out a 10% discount!) The imperial weights fit particularly well with the quantities of things that people might want to buy - I know exactly what I'm getting in a quarter of mushrooms, an ounce of yeast or a pound of mince and so that's what I continue to ask for despite the EU's attempts to homogenise us all with baffling amounts. Long live the pound, the pint and the mile, I say. And to return the date. It is of course the departure from the Imperial norm made by Americans (when and why I have yet to discover) that causes all the problems. Who else could come up with a system that takes a unit from its rightful place in between the lower and the higher and sticks it at the front? You don't do mm:hh:ss so why MM:dd:yy Bewildering!

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

                                    I think the reason it was done is plain - Americans (and some others) tend to say When speaking it is rare to include the Year It is sensible to speak the largest part first So - June 5th narrows down the target as it is spoken - ideal! So Yanks take that as 6/5 Then slam the date on the wrong end because it seems less important to them. Idiotic - but then so is belief that the constitution means you can own an arsenal many a small country would be proud to own...

                                    PooperPig - Coming Soon

                                    9 1 Reply Last reply
                                    0
                                    • C Colin Mullikin

                                      As far as date is concerned, I prefer the "July 22, 2015" format. There is no room for ambiguity. However, when it comes to Imperial v. Metric. I am strictly in the Metric for science, Imperial for every day use camp. For instance, I have an intuition for how far a mile is, or how much a 50lb bag of sand weighs, but I have no clue how far a kilometer is or how much a 50kg bag of sand might weigh. Yes, I know what the conversion factors are, but I have to think about it, then convert to Imperial, just so I can be in the right ballpark. You could say, "Oh, well to Hell with current adults, we should do it for the children." But that creates a problem, because then you have two generations, who are in close proximity (parent/child relationships), using two different systems, and if the Common Core Math standards have taught us anything, it's that parents get really pissed when they're too stubborn and/or stupid to learn how to do their children's math homework.

                                      The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin

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

                                      it's a narrowing thing. It is (in principal) better to start with the biggest entity and narrow it down, than to start with an arbitrary portion. Like with addresses (which are almost universally written in exactly the opposite way) England > West Midlands > Sutton Coldfield > Four Oaks > Kenilworth Close > 2 2015 > July > 22nd The only reason for using July 22nd, 1988 would be if generally the dates you are looking at are for the same year, and so the year portion is of less import. So it depends on the use -case

                                      PooperPig - Coming Soon

                                      1 Reply Last reply
                                      0
                                      • C Chris Maunder

                                        I'm trying to set a value to the maximum smalldatetime allowed in SQL, yet what's appearing is "6 June 1979". Nothing I do seems to work: ensuring Culture is OK, ensuring I'm passing dates around in a sensible format, ensuring the data I'm setting is the actual date I'm setting. In the debugger I see _date with a value of "6/06/2079 12:00:00 AM" (see rant below). The date is fine. I pass this into a formatter to turn it into "dd-MMM-yy" format. That works perfectly and the output is correct. This string goes to the user, they hit submit, it comes back and is parsed fine. Everything works perfectly. Except the date always comes back as 1979. ARGH. And then I spot it. 15 years too late I've been hit by the Y2K bug. 6/06/2079 12:00:00 AM is 6 Jun 2079 -> "6-Jun-79" which is parsed as 6-Jun-1979. /more coffee, then better formatting. As a side note: The American date format (mm/dd/yyyy) is painfully and dangerously ambiguous so given that OS installs are often set with US as the region, surely debuggers should display dates and times as dd-MMM-yyyy or even better, yyyy-mm-dd to account for the Rest Of The World who wants to scream everytime they get an email saying "the date is 4/7/2015".

                                        cheers Chris Maunder

                                        I Offline
                                        I Offline
                                        imagiro
                                        wrote on last edited by
                                        #19

                                        Looks like the Y2K bug will still haunt us for at least the next 00 years...

                                        1 Reply Last reply
                                        0
                                        • 9 9082365

                                          How does the metric system make more sense? It's no less arbitrary and the assumption that people will find the arithmetic less difficult is highly doubtful (shortly after we decimalised currency in the UK I was delayed by several minutes in a shop because the assistant needed to fetch a calculator to work out a 10% discount!) The imperial weights fit particularly well with the quantities of things that people might want to buy - I know exactly what I'm getting in a quarter of mushrooms, an ounce of yeast or a pound of mince and so that's what I continue to ask for despite the EU's attempts to homogenise us all with baffling amounts. Long live the pound, the pint and the mile, I say. And to return the date. It is of course the departure from the Imperial norm made by Americans (when and why I have yet to discover) that causes all the problems. Who else could come up with a system that takes a unit from its rightful place in between the lower and the higher and sticks it at the front? You don't do mm:hh:ss so why MM:dd:yy Bewildering!

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

                                          Member 9082365 wrote:

                                          Bewildering!

                                          Yeah, damn foreigners. ;)

                                          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