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. Other Discussions
  3. The Weird and The Wonderful
  4. It was the 13th hour of the 13th day of the 13th month...

It was the 13th hour of the 13th day of the 13th month...

Scheduled Pinned Locked Moved The Weird and The Wonderful
23 Posts 17 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.
  • F Fernando A Gomez F

    So here's the code for an appointment management WebPart a previous programmer did:

    DateTime primer = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
    DateTime ultimo = new DateTime(DateTime.Today.Year, DateTime.Today.Month + 1, 1);

    So obviously the thingy stopped working exactly today, as Schmarz is not yet recognized as a month... Sigh. :sigh:

    T Offline
    T Offline
    TorstenFrings
    wrote on last edited by
    #12

    the real WTF is, that this may fail in the very rare case, when the year switches between the evaluation of DateTime.Today.Year and DateTime.Today.Month, leading to a primer one year back in the past... but this may not be an issue if the code will not be executed during new years eve ;)

    1 Reply Last reply
    0
    • F Fernando A Gomez F

      So here's the code for an appointment management WebPart a previous programmer did:

      DateTime primer = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
      DateTime ultimo = new DateTime(DateTime.Today.Year, DateTime.Today.Month + 1, 1);

      So obviously the thingy stopped working exactly today, as Schmarz is not yet recognized as a month... Sigh. :sigh:

      I Offline
      I Offline
      ii_noname_ii
      wrote on last edited by
      #13

      LOL. *points and laughs loudly at incompetance* No excuses for this one.

      1 Reply Last reply
      0
      • F Fernando A Gomez F

        So here's the code for an appointment management WebPart a previous programmer did:

        DateTime primer = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
        DateTime ultimo = new DateTime(DateTime.Today.Year, DateTime.Today.Month + 1, 1);

        So obviously the thingy stopped working exactly today, as Schmarz is not yet recognized as a month... Sigh. :sigh:

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

        You need to convince your employer that their calendars are wrong. Admitting mistakes in code cannot end well.

        F 1 Reply Last reply
        0
        • L Lost User

          You need to convince your employer that their calendars are wrong. Admitting mistakes in code cannot end well.

          F Offline
          F Offline
          Fernando A Gomez F
          wrote on last edited by
          #15

          Hehehe, actually, aside from me being called at 4 A.M., it turned out pretty well for us: the other software company got their asses kicked off of the project, and we already got another project with this customer... So, all in all, it worked for us!

          P 1 Reply Last reply
          0
          • P PaulLinton

            Yes, it is bad but understandable. The equivalent of that code works just fine in Excel, for example. Try "=Date(2011,Month(Today())+1,1)" and you get 1/1/2012 which seems sensible to me. It's a coding style I have used for years. No excuses, I'm just saying.

            J Offline
            J Offline
            Jasmine2501
            wrote on last edited by
            #16

            I don't think it's "understandable" when an ASP.Net programmer makes a mistake like this. Presumably they weren't hired for their Excel skills?

            1 Reply Last reply
            0
            • F Fernando A Gomez F

              So here's the code for an appointment management WebPart a previous programmer did:

              DateTime primer = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
              DateTime ultimo = new DateTime(DateTime.Today.Year, DateTime.Today.Month + 1, 1);

              So obviously the thingy stopped working exactly today, as Schmarz is not yet recognized as a month... Sigh. :sigh:

              E Offline
              E Offline
              ekolis
              wrote on last edited by
              #17

              Maybe he got the calendar mixed up with the zodiac... when exactly is the sign of Ophiucus again? :) (OH GOD now I have "we are now in the age of aquarius... aquarius... AQUAAAARIUS" stuck in my head...)

              1 Reply Last reply
              0
              • F Fernando A Gomez F

                So here's the code for an appointment management WebPart a previous programmer did:

                DateTime primer = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
                DateTime ultimo = new DateTime(DateTime.Today.Year, DateTime.Today.Month + 1, 1);

                So obviously the thingy stopped working exactly today, as Schmarz is not yet recognized as a month... Sigh. :sigh:

                J Offline
                J Offline
                James Lonero
                wrote on last edited by
                #18

                The coding horror is when you see the same Code Project Discussion two days in a row. That's horrible.

                1 Reply Last reply
                0
                • P Paladin2000

                  DateTime ultimo = primer.AddMonths(1);

                  ftfy.

                  K Offline
                  K Offline
                  KP Lee
                  wrote on last edited by
                  #19

                  Why give "useful" info to someone who obviously doesn't need it? (Someone slammed by someone else's non-thinking moment, not, "What did I do wrong?".)

                  1 Reply Last reply
                  0
                  • F Fernando A Gomez F

                    So here's the code for an appointment management WebPart a previous programmer did:

                    DateTime primer = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
                    DateTime ultimo = new DateTime(DateTime.Today.Year, DateTime.Today.Month + 1, 1);

                    So obviously the thingy stopped working exactly today, as Schmarz is not yet recognized as a month... Sigh. :sigh:

                    G Offline
                    G Offline
                    Gary R Wheeler
                    wrote on last edited by
                    #20

                    Reminds me of a project I worked on in 1992. I was controlling a piece of hardware which had its own real-time clock. We discovered that it did not handle the rollover for leap year correctly, so we reported a bug to the developer for the firmware on the device. He 'solved' the problem by disallowing setting the date to the month of February :rolleyes:.

                    Software Zen: delete this;

                    A 1 Reply Last reply
                    0
                    • G Gary R Wheeler

                      Reminds me of a project I worked on in 1992. I was controlling a piece of hardware which had its own real-time clock. We discovered that it did not handle the rollover for leap year correctly, so we reported a bug to the developer for the firmware on the device. He 'solved' the problem by disallowing setting the date to the month of February :rolleyes:.

                      Software Zen: delete this;

                      A Offline
                      A Offline
                      Albert Holguin
                      wrote on last edited by
                      #21

                      I can see him now... "FIXED!"

                      1 Reply Last reply
                      0
                      • F Fernando A Gomez F

                        Hehehe, actually, aside from me being called at 4 A.M., it turned out pretty well for us: the other software company got their asses kicked off of the project, and we already got another project with this customer... So, all in all, it worked for us!

                        P Offline
                        P Offline
                        prasun r
                        wrote on last edited by
                        #22

                        well IT industry is funny ;)

                        1 Reply Last reply
                        0
                        • F Fernando A Gomez F

                          So here's the code for an appointment management WebPart a previous programmer did:

                          DateTime primer = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
                          DateTime ultimo = new DateTime(DateTime.Today.Year, DateTime.Today.Month + 1, 1);

                          So obviously the thingy stopped working exactly today, as Schmarz is not yet recognized as a month... Sigh. :sigh:

                          K Offline
                          K Offline
                          krumia
                          wrote on last edited by
                          #23

                          Quote:

                          It was the 13th hour of the 13th day of the 13th month...

                          Nice subject! :-D

                          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