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. 13th Month ?

13th Month ?

Scheduled Pinned Locked Moved The Weird and The Wonderful
question
13 Posts 12 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.
  • V virang_21

    I was writing an application which takes credit card payment and to create a list of months I used

    DateTimeFormatInfo.InvariantInfo.MonthNames

    and I got surprised when I got 13 elements as a return. Jan to Dec and an empty month. I wonder why it was done like that ?

    string[] allMonths = DateTimeFormatInfo
    .InvariantInfo
    .MonthNames;
    Console.WriteLine("No of Months : {0}", allMonths.Length); // And you get 13

           for (int i = 0; i < allMonths.Length; i++) Console.WriteLine("Month {0} {1}", i, allMonths\[i\]);
    

    Why put 13th element as "" string ?

    Zen and the art of software maintenance : rm -rf * Maths is like love : a simple idea but it can get complicated.

    P Offline
    P Offline
    PIEBALDconsult
    wrote on last edited by
    #2

    So a ListBox or similar can show an "unselected" value? A problem we ran into at one job I had was credit cards with month 00. :omg:

    1 Reply Last reply
    0
    • V virang_21

      I was writing an application which takes credit card payment and to create a list of months I used

      DateTimeFormatInfo.InvariantInfo.MonthNames

      and I got surprised when I got 13 elements as a return. Jan to Dec and an empty month. I wonder why it was done like that ?

      string[] allMonths = DateTimeFormatInfo
      .InvariantInfo
      .MonthNames;
      Console.WriteLine("No of Months : {0}", allMonths.Length); // And you get 13

             for (int i = 0; i < allMonths.Length; i++) Console.WriteLine("Month {0} {1}", i, allMonths\[i\]);
      

      Why put 13th element as "" string ?

      Zen and the art of software maintenance : rm -rf * Maths is like love : a simple idea but it can get complicated.

      T Offline
      T Offline
      tgrt
      wrote on last edited by
      #3

      To stay in line with some calendars (Hebrew) that can have a 13th month?

      K 1 Reply Last reply
      0
      • V virang_21

        I was writing an application which takes credit card payment and to create a list of months I used

        DateTimeFormatInfo.InvariantInfo.MonthNames

        and I got surprised when I got 13 elements as a return. Jan to Dec and an empty month. I wonder why it was done like that ?

        string[] allMonths = DateTimeFormatInfo
        .InvariantInfo
        .MonthNames;
        Console.WriteLine("No of Months : {0}", allMonths.Length); // And you get 13

               for (int i = 0; i < allMonths.Length; i++) Console.WriteLine("Month {0} {1}", i, allMonths\[i\]);
        

        Why put 13th element as "" string ?

        Zen and the art of software maintenance : rm -rf * Maths is like love : a simple idea but it can get complicated.

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

        Apparently it's to do with Calendar objects using 13 months as well. This rabbit hole runs deep. DateTimeFormatInfo.MonthNames Property (MSDN)[^]

        Jeremy Falcon

        1 Reply Last reply
        0
        • V virang_21

          I was writing an application which takes credit card payment and to create a list of months I used

          DateTimeFormatInfo.InvariantInfo.MonthNames

          and I got surprised when I got 13 elements as a return. Jan to Dec and an empty month. I wonder why it was done like that ?

          string[] allMonths = DateTimeFormatInfo
          .InvariantInfo
          .MonthNames;
          Console.WriteLine("No of Months : {0}", allMonths.Length); // And you get 13

                 for (int i = 0; i < allMonths.Length; i++) Console.WriteLine("Month {0} {1}", i, allMonths\[i\]);
          

          Why put 13th element as "" string ?

          Zen and the art of software maintenance : rm -rf * Maths is like love : a simple idea but it can get complicated.

          J Offline
          J Offline
          JMK NI
          wrote on last edited by
          #5

          Lousy Smarch[^] weather!

          1 Reply Last reply
          0
          • V virang_21

            I was writing an application which takes credit card payment and to create a list of months I used

            DateTimeFormatInfo.InvariantInfo.MonthNames

            and I got surprised when I got 13 elements as a return. Jan to Dec and an empty month. I wonder why it was done like that ?

            string[] allMonths = DateTimeFormatInfo
            .InvariantInfo
            .MonthNames;
            Console.WriteLine("No of Months : {0}", allMonths.Length); // And you get 13

                   for (int i = 0; i < allMonths.Length; i++) Console.WriteLine("Month {0} {1}", i, allMonths\[i\]);
            

            Why put 13th element as "" string ?

            Zen and the art of software maintenance : rm -rf * Maths is like love : a simple idea but it can get complicated.

            F Offline
            F Offline
            Freak30
            wrote on last edited by
            #6

            Maybe this was converted from unmanaged code (where the length of an array is unknown). You would just iterate over the months until you found an empty string.

            The good thing about pessimism is, that you are always either right or pleasently surprised.

            1 Reply Last reply
            0
            • T tgrt

              To stay in line with some calendars (Hebrew) that can have a 13th month?

              K Offline
              K Offline
              Keith Barrow
              wrote on last edited by
              #7

              TIL that the Hebrew calendar can have an extra month to keep it's lunar cycle in sync with the solar year. Source[^]

              Alberto Brandolini:

              The amount of energy necessary to refute bullshit is an order of magnitude bigger than to produce it.

              1 Reply Last reply
              0
              • V virang_21

                I was writing an application which takes credit card payment and to create a list of months I used

                DateTimeFormatInfo.InvariantInfo.MonthNames

                and I got surprised when I got 13 elements as a return. Jan to Dec and an empty month. I wonder why it was done like that ?

                string[] allMonths = DateTimeFormatInfo
                .InvariantInfo
                .MonthNames;
                Console.WriteLine("No of Months : {0}", allMonths.Length); // And you get 13

                       for (int i = 0; i < allMonths.Length; i++) Console.WriteLine("Month {0} {1}", i, allMonths\[i\]);
                

                Why put 13th element as "" string ?

                Zen and the art of software maintenance : rm -rf * Maths is like love : a simple idea but it can get complicated.

                P Offline
                P Offline
                Power Puff Boy
                wrote on last edited by
                #8

                Earth's rotation is gradually getting slower and instead of adding an extra day every couple of years it will one day be more convenient to add an extra month. I guess a good name just hasn't been found yet.

                D 1 Reply Last reply
                0
                • P Power Puff Boy

                  Earth's rotation is gradually getting slower and instead of adding an extra day every couple of years it will one day be more convenient to add an extra month. I guess a good name just hasn't been found yet.

                  D Offline
                  D Offline
                  den2k88
                  wrote on last edited by
                  #9

                  Tricember?

                  N 1 Reply Last reply
                  0
                  • D den2k88

                    Tricember?

                    N Offline
                    N Offline
                    Nicholas Marty
                    wrote on last edited by
                    #10

                    If you'd follow the pattern it would be Undecember ;)

                    Richard DeemingR 1 Reply Last reply
                    0
                    • N Nicholas Marty

                      If you'd follow the pattern it would be Undecember ;)

                      Richard DeemingR Offline
                      Richard DeemingR Offline
                      Richard Deeming
                      wrote on last edited by
                      #11

                      As previously pointed out[^], the official name for the 13th month is "Smarch[^]". :-D https://www.youtube.com/watch?v=mTJ6GPGMozo[^]


                      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                      D 1 Reply Last reply
                      0
                      • Richard DeemingR Richard Deeming

                        As previously pointed out[^], the official name for the 13th month is "Smarch[^]". :-D https://www.youtube.com/watch?v=mTJ6GPGMozo[^]


                        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                        D Offline
                        D Offline
                        den2k88
                        wrote on last edited by
                        #12

                        Ah yes, my usual deadlines (when I'm asked to estimate some) :D

                        1 Reply Last reply
                        0
                        • V virang_21

                          I was writing an application which takes credit card payment and to create a list of months I used

                          DateTimeFormatInfo.InvariantInfo.MonthNames

                          and I got surprised when I got 13 elements as a return. Jan to Dec and an empty month. I wonder why it was done like that ?

                          string[] allMonths = DateTimeFormatInfo
                          .InvariantInfo
                          .MonthNames;
                          Console.WriteLine("No of Months : {0}", allMonths.Length); // And you get 13

                                 for (int i = 0; i < allMonths.Length; i++) Console.WriteLine("Month {0} {1}", i, allMonths\[i\]);
                          

                          Why put 13th element as "" string ?

                          Zen and the art of software maintenance : rm -rf * Maths is like love : a simple idea but it can get complicated.

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

                          Actually there is a good reason for that. Depending on your locale, some calendars have 13 months. This is especially true for cultures that have the lunar calendar, thus adding an extra month once every so many years.

                          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