如何使用javascript获取每月的某天? [英] How do I get the day of the month in javascript?

查看:40
本文介绍了如何使用javascript获取每月的某天?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从Date对象获取星期几,但是 getDay()方法似乎返回星期几.是否有返回月份的功能?

I need to get the day of the month from a Date object but it seems that the getDay() method returns the day of the week. Is there a function that returns the day of the month?

推荐答案

使用 date_object

Use date_object.getDate() to get the month day.

从MDN文档链接:

根据当地时间返回指定日期的月份."

这篇关于如何使用javascript获取每月的某天?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆