Alex Rivera | Logout

Use jQuery/JS to determine the DAY OF WEEK

Asked 2009-07-23T20:33:14.080
25

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.

Edit
Report

2 Answers

9
today = new Date()
dayIndex = today.getDay()

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

0 = Sunday
1 = Monday
2 = Tuesday
3 = Wednesday
4 = Thursday
5 = Friday
6 = Saturday
answered 2009-07-23T20:36:39.567
2

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

answered 2009-07-23T20:39:48.000

Your Answer