Get the number of days in a javascript date object

//27 <- today day number
new Date().getDay() = new Date().getUTCDay() //<- 5 (friday)? what?

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

+3
source share
4 answers

You are looking for .getDate():

new Date().getDate();

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

+10
source

The one you are looking for is .getDate()not.getDay()

Date Object Reference

+2
source

You have to use

new Date().getDate()
+1
source

getDay and getUTCDay returns the number of days of the week. You need getDate () and etUTCDate ()

+1
source

All Articles