get number of day in javascript date object
21,265
Solution 1
You're looking for .getDate()
:
new Date().getDate();
.getDay()
returns the day number 0 (Sunday) to 6 (Saturday).
Solution 2
The one you are looking for is .getDate()
, not .getDay()
Solution 3
You should use
new Date().getDate()
Solution 4
getDay and getUTCDay returns the number of the weekday. You need getDate() and etUTCDate()
Related videos on Youtube
Author by
puchu
Updated on July 05, 2022Comments
-
puchu almost 2 years
//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 likeYUI.Date.format()
?-
Jason almost 12 years^ I just had the same thought myself; couldn't resist upvoting.
-