date - Problem with getDay() method javascript -


i'm trying day name in javascript. every time search usage of function getday(), explained method returns day of week, example: 0 sunday, 1 monday etc.

so 1st janauary 2010 friday, can explain why i'm getting 1 instead of 5? same 2nd janauary 2010, i'm getting 2 instead of 5.

i've tried ways without success.

here's code :

theday = new date(2010,01,01);   alert(theday.getday()); 

thank !!!

the month in js zero-based, day of week.

date(2010,01,01) 1 february, 2010. january month zero. sure enough, 1 february 2010 monday (i remember well).

try this:

var theday = new date(2010,00,01);   alert(theday.getday()); 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -