作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
只是为了简化我的问题,我有以下代码
var date = new Date( 2015 , 10 , 16 );
//print the day of the week on console
console.log( date.getDay() ); //prints 1
据我所知它应该打印 5 因为它是星期五而不是星期一但它不是,可能是什么问题或者我不理解日期对象?
谢谢。
最佳答案
您的问题是 Date
构造函数的月份部分是基于 0
的。 (参见 doc)
month
Integer value representing the month, beginning with 0 for January to 11 for December.
如果您要在 JavaScript 控制台中构建日期,您可以看到:
new Date( 2015 , 10 , 16 )
> Mon Nov 16 2015 00:00:00 GMT-0500 (EST)
关于javascript - 如何在给定日期的情况下返回正确的星期几 - 年月日,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33136387/
本文实例为大家分享了php实现按天数、星期、月份查询的搜索框,搜索时候展示数据的统计图,主要展示图形的效果,供大家参考,具体内容如下 1.ajax.php ?
星期-时间时刻散点平面坐标系统计大小量,Python,matplotlib,散点图(1) 假设现在有一堆年月日时数据,形如t=2022-07-31 23:45:12,每一条这样的时刻都对应发生了一次事
我想以 EEEE d, MMMM 格式自定义此显示日、日期和月份格式。 提前致谢。 最佳答案 这是完全合乎逻辑的。你可以试试这个 public static class EndDatePickerFr
我是一名优秀的程序员,十分优秀!