PDA

View Full Version : Type casting from Month to integer


ScottInTexas
12-31-2002, 08:26 PM
I want to check the current month (11) and create an array that is set from 0 to 11 with the current month in the 0th pos and following from there.

So I get the current month from the date object and try to increment it but no good. What is the syntax to convert the 11th month to a numeric value?

Any ideas or has anyone done this? I need to be able to start the array at any value between 0 and 11 increment up to 11 and start again from 0 after that.

As always, Thanks!
And HAPPY NEW YEAR:thumbsup:

ScottInTexas
01-01-2003, 03:31 PM
A big giant DUH!!!!!!:o

It wasn't the thing causing the error! Sorry about the stupid post.

Here's what I ended up with.

firstMonth=now.getMonth(); //get current month
monOrder[0]=firstMonth; //set first array value
firstMonth+=1;
for (var n=1;n<12;n++){ //cycle thru months
if ((firstMonth)>11)
firstMonth-=11; //set back to beginning
monOrder[n]=firstMonth;
firstMonth+=1;


Thanks All,