-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
今天发现个意外惊喜,原来日期函数还能这样玩 #119
Comments
好简洁!不过刚刚测试了一下,发现不应该是 |
应该是month,而不是month+1> |
是month+1,因为new Date().getMonth() ,返回的值是从0开始的 |
我查了MDN文档, |
new Date(2016,6,0).getDate() //30 |
|
原文链接
如何获得某个月的天数?
再也不用考虑闰年,大小月不同了,太简洁了;兼容性非常不错
发现原来以前ajax返回的时间格式是可以直接用new Date转换的
后端返回的时间格式:2015-05-11T12:22:33.111
以前我的做法,是先用reaplace(/T/,' ').replace(/-/g,'/');
现在可以直接使用new Date('2015-05-11T12:22:33.111');
不过这样做有兼容问题,在IE9以下版本是无法转换成正确的日期的。
The text was updated successfully, but these errors were encountered: