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

totymedli
  • 29,531
  • 22
  • 131
  • 165
puchu
  • 3,294
  • 6
  • 38
  • 62

4 Answers4

29

You're looking for .getDate():

new Date().getDate();

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

Andy E
  • 338,112
  • 86
  • 474
  • 445
4

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

Date Object Reference

ShaneBlake
  • 11,056
  • 2
  • 26
  • 43
1

You should use

new Date().getDate()
J. Bruni
  • 20,322
  • 12
  • 75
  • 92
1

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

Reporter
  • 3,897
  • 5
  • 33
  • 47