17
//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()?

2
  • ^ I just had the same thought myself; couldn't resist upvoting.
    – Jason
    Aug 13, 2012 at 23:12
  • It is not clear what is expected as an answer. Question is not relevant with the answers below. It is confusing to assign UTCDay to getDay.
    – esenkaya
    Sep 26 at 16:03

4 Answers 4

29

You're looking for .getDate():

new Date().getDate();

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

0
4

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

Date Object Reference

1

You should use

new Date().getDate()
1

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

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.