我需要从Date对象获取月中的某一天,但似乎该getDay()方法返回星期几.是否有一个函数可以返回该月的某一天?
I H*_*azy 62
使用date_object.getDate()得到一个月的日子.
从MDN文档链接:
"根据当地时间返回指定日期的月中日期."
const date = new Date();
const day = date.getDate();
const month = date.getMonth() + 1;
const year = date.getFullYear();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
36226 次 |
| 最近记录: |