views:

42

answers:

1

Any idea why the day is coming out wrong when the date is accurate?

I'm debugging and I can see the date variables which are correct but the day is wrong.

date Date (@9f14161) date 26 [0x1a]
dateUTC 26 [0x1a]
day 5
dayUTC 5
fullYear 2010 [0x7da]
fullYearUTC 2010 [0x7da]
hours 17 [0x11]
hoursUTC 17 [0x11]
milliseconds 0
millisecondsUTC 0
minutes 0
minutesUTC 0
month 10 [0xa]
monthUTC 10 [0xa]
seconds 0
secondsUTC 0
time 1290790800000 [0x12c89208a80]
timezoneOffset 0

That is my date variables, as you can see, The date is 26 (today), month is 10 (this month) and the year is 2010 (this year) yet the day is coming out at 5 which is a friday.

+3  A: 

The month begins with 0, so a month with the value 10 is not october but november. So friday (day = 5) is correct in your example.

hering