Idea behind month numbering in JavaScript?!
-
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
-
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
It makes sense to me. Days are numeric. Months are not numeric, so they are represented by an index. Though I could see using a 1-based index as acceptable in this case to keep things more consistent.
Driven to the ARMs by x86.
-
It makes sense to me. Days are numeric. Months are not numeric, so they are represented by an index. Though I could see using a 1-based index as acceptable in this case to keep things more consistent.
Driven to the ARMs by x86.
AspDotNetDev wrote:
Months are not numeric
January: 1 February :2 ... :doh:
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."
-
It makes sense to me. Days are numeric. Months are not numeric, so they are represented by an index. Though I could see using a 1-based index as acceptable in this case to keep things more consistent.
Driven to the ARMs by x86.
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.
-
AspDotNetDev wrote:
Months are not numeric
January: 1 February :2 ... :doh:
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."
January being the first month does not make it numeric.
Driven to the ARMs by x86.
-
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.
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.
-
January being the first month does not make it numeric.
Driven to the ARMs by x86.
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."
-
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."
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.
-
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.
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
-
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.
Why is Pi Day celebrated in March then :-\
-
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
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 thattm_year
was defined asyear - 1900
, notyear % 100
. Cheers from an old fart whose memory isn't quite gone ;P yet PeterSoftware rusts. Simon Stephenson, ca 1994.
-
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
Huh, that's not ISO 8601 compliant. :sigh:
-
Huh, that's not ISO 8601 compliant. :sigh:
-
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.
-
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 thattm_year
was defined asyear - 1900
, notyear % 100
. Cheers from an old fart whose memory isn't quite gone ;P yet PeterSoftware rusts. Simon Stephenson, ca 1994.
-
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.
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.
-
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.