开发者

get number of day in javascript date object

开发者 https://www.devze.com 2023-03-09 05:34 出处:网络
//27 <- today day number new Dat开发者_高级运维e().getDay() = new Date().getUTCDay() //<- 5 (friday)? what?
//27 <- today day number
new Dat开发者_高级运维e().getDay() = new Date().getUTCDay() //<- 5 (friday)? what?

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


You're looking for .getDate():

new Date().getDate();

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


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

Date Object Reference


You should use

new Date().getDate()


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

0

精彩评论

暂无评论...
验证码 换一张
取 消