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. Idea behind month numbering in JavaScript?!

Idea behind month numbering in JavaScript?!

Scheduled Pinned Locked Moved The Lounge
javascriptquestion
17 Posts 9 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 Vark111

    AspDotNetDev wrote:

    Days are numeric. Months are not numeric, so they are represented by an index.

    I understand the point, but disagree on semantics. If months are an enumeration because they are of a limited set, then days fall under that description as well. After all, there is never going to be a 35th day, so days can't *really* be represented by numbers, either.

    A Offline
    A Offline
    AspDotNetDev
    wrote on last edited by
    #6

    The point is that the common way to refer to a year is a number, the common way to refer to a month is a name, and the common way to refer to a day is a number (unless you are going by weekdays, but that's a different date system). Since January is the first month and not "month 1", you can choose how to index it. That days are limited in a given month (and year) has nothing to do with them being numbers or not.

    Driven to the ARMs by x86.

    W S 2 Replies Last reply
    0
    • A AspDotNetDev

      January being the first month does not make it numeric.

      Driven to the ARMs by x86.

      L Offline
      L Offline
      LloydA111
      wrote on last edited by
      #7

      Well surely on that basis any day of the week is also not numeric?


      See if you can crack this: b749f6c269a746243debc6488046e33f
      So far, no one seems to have cracked this!

      The unofficial awesome history of Code Project's Bob! "People demand freedom of speech to make up for the freedom of thought which they avoid."

      A 1 Reply Last reply
      0
      • L LloydA111

        Well surely on that basis any day of the week is also not numeric?


        See if you can crack this: b749f6c269a746243debc6488046e33f
        So far, no one seems to have cracked this!

        The unofficial awesome history of Code Project's Bob! "People demand freedom of speech to make up for the freedom of thought which they avoid."

        A Offline
        A Offline
        AspDotNetDev
        wrote on last edited by
        #8

        Different coordinate system, if you will. If you were using a Year-Week-Day system to identify a date (e.g., 2011-33-Friday), then you would be correct.

        Driven to the ARMs by x86.

        L 1 Reply Last reply
        0
        • A AspDotNetDev

          The point is that the common way to refer to a year is a number, the common way to refer to a month is a name, and the common way to refer to a day is a number (unless you are going by weekdays, but that's a different date system). Since January is the first month and not "month 1", you can choose how to index it. That days are limited in a given month (and year) has nothing to do with them being numbers or not.

          Driven to the ARMs by x86.

          W Offline
          W Offline
          wout de zeeuw
          wrote on last edited by
          #9

          You're getting outnumbered! Using numbers for months is common too, 12/31/2011. Besides an enumeration _is_ numeric (from the word numerus, remember?).

          Wout

          1 Reply Last reply
          0
          • A AspDotNetDev

            The point is that the common way to refer to a year is a number, the common way to refer to a month is a name, and the common way to refer to a day is a number (unless you are going by weekdays, but that's a different date system). Since January is the first month and not "month 1", you can choose how to index it. That days are limited in a given month (and year) has nothing to do with them being numbers or not.

            Driven to the ARMs by x86.

            S Offline
            S Offline
            Samuel Cragg
            wrote on last edited by
            #10

            Why is Pi Day celebrated in March then :-\

            1 Reply Last reply
            0
            • M mike_ko

              I mean,

              var transactionDate = new Date(2011, 0, 21);

              means January 21, 2011?! Who got this idea? Was he sober or having some tequila shots! Mybe he should've continued with this eye popping logic to include years and days: so January 21, 2011 would be

              new Date(2010, 0, 20);

              :) Cheers Mikee

              P Offline
              P Offline
              Peter_in_2780
              wrote on last edited by
              #11

              A long long time ago (mid-1970s, probably before most of you were born) in a galaxy far away (Bell Labs) Dennis Ritchie and a few of his good mates developed a programming language they called 'C'. As part of the original run time library, they included some basic date/time routines and structures. And that's where it all started. Their mindset bit me twice - once later in the 1970s when I found tm_mon == 1 in February, and once in the late 1990s when I discovered that tm_year was defined as year - 1900, not year % 100. Cheers from an old fart whose memory isn't quite gone ;P yet Peter

              Software rusts. Simon Stephenson, ca 1994.

              L 1 Reply Last reply
              0
              • M mike_ko

                I mean,

                var transactionDate = new Date(2011, 0, 21);

                means January 21, 2011?! Who got this idea? Was he sober or having some tequila shots! Mybe he should've continued with this eye popping logic to include years and days: so January 21, 2011 would be

                new Date(2010, 0, 20);

                :) Cheers Mikee

                P Online
                P Online
                PIEBALDconsult
                wrote on last edited by
                #12

                Huh, that's not ISO 8601 compliant. :sigh:

                M 1 Reply Last reply
                0
                • P PIEBALDconsult

                  Huh, that's not ISO 8601 compliant. :sigh:

                  M Offline
                  M Offline
                  mike_ko
                  wrote on last edited by
                  #13

                  Well I discoverd this the hard way (debugging, banging head, alcohol, etc...) Maybe re-considering this Javascript terminology would not be a bad idea; so that it will be Gregorian, and mind, wise :) Cheers Mikee

                  1 Reply Last reply
                  0
                  • A AspDotNetDev

                    Different coordinate system, if you will. If you were using a Year-Week-Day system to identify a date (e.g., 2011-33-Friday), then you would be correct.

                    Driven to the ARMs by x86.

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

                    By your logic days of the week should start at zero also. [edit]I think this still holds true.[/edit]

                    The best things in life are not things.

                    A 1 Reply Last reply
                    0
                    • P Peter_in_2780

                      A long long time ago (mid-1970s, probably before most of you were born) in a galaxy far away (Bell Labs) Dennis Ritchie and a few of his good mates developed a programming language they called 'C'. As part of the original run time library, they included some basic date/time routines and structures. And that's where it all started. Their mindset bit me twice - once later in the 1970s when I found tm_mon == 1 in February, and once in the late 1990s when I discovered that tm_year was defined as year - 1900, not year % 100. Cheers from an old fart whose memory isn't quite gone ;P yet Peter

                      Software rusts. Simon Stephenson, ca 1994.

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

                      Remember that, got bitten many times. I think hope I have learnt my lesson now.

                      The best things in life are not things.

                      1 Reply Last reply
                      0
                      • L Lost User

                        By your logic days of the week should start at zero also. [edit]I think this still holds true.[/edit]

                        The best things in life are not things.

                        A Offline
                        A Offline
                        AspDotNetDev
                        wrote on last edited by
                        #16

                        Only in a number system in which they are known primarily by their names (e.g., weekdays) rather than by their number (e.g., month days). And I didn't say they should start at zero... only that, being an index rather than the common number identifier, they could start at zero (or 1).

                        Driven to the ARMs by x86.

                        L 1 Reply Last reply
                        0
                        • A AspDotNetDev

                          Only in a number system in which they are known primarily by their names (e.g., weekdays) rather than by their number (e.g., month days). And I didn't say they should start at zero... only that, being an index rather than the common number identifier, they could start at zero (or 1).

                          Driven to the ARMs by x86.

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

                          On reflection, I tend to agree with you.

                          The best things in life are not things.

                          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