views:

669

answers:

3

Is there a method using either JavaScript or jQuery to determine what day of the week it is? For instance, if the date a user picks in the box is a Sunday, I can alert them.

Thanks

+2  A: 

Javascript Date Object

new Date().getDay();  //0=Sun, 1=Mon, ..., 6=Sat
Kip
thank you much! :)
Jason
+2  A: 
today=new Date()
thisDay=today.getDay()

... will get you a numeric representation to "today".

Emil Stenström
which one is sunday? :)
Jason
Zero is Sunday :) Because it's a language from the US. In Europe it would make more sense to have monday as zero, but that's not the case here.
Emil Stenström
+1  A: 

If you need a lot of date handling, take a look at DateJS.

Nosredna