get number of day in javascript date object

puchu picture puchu · May 27, 2011 · Viewed 15.5k times · Source
//27 <- today day number
new Date().getDay() = new Date().getUTCDay() //<- 5 (friday)? what?

Do I have to parse the result with .toString() or use something like YUI.Date.format()?

Answer

Andy E picture Andy E · May 27, 2011

You're looking for .getDate():

new Date().getDate();

.getDay() returns the day number 0 (Sunday) to 6 (Saturday).