各位高手大侠,为什么用js 计算出来的1980-02-01到1980-01-01相差的天数只有29天?
解决方案 »
- 如下页面代码,点击添加事件后,就回到页面顶部了,不让它回顶部怎么解决
- 怎样在jsp中在两个列表框之间通过按钮动态添加和删除列表中元素
- 高手们快帮我看看啊,急~~~~~~~~~~~~~~~~~在线等。。。
- easyui toolbar 如何把按钮显示在两行?
- javascript能否做出在线图片处理程序?要实现类似photoshop那样的功能。
- 为什么在htc中模态窗口的返回值始终为undefined
- 关于在网页中使用"组合捷"的问题....
- 自选背景色,用javascript脚本怎样写?
- 帮忙解释一下!!!!!!
- 如何将子窗口中的数据传到其父窗口
- 关于jqgrid的一个基本的问题,请达人们帮帮忙。
- 求高手解释!!!!
var d2 ="1980/01/01"
var s = new Date(d1)-new Date(d2)
alert(s/1000/3600/24)
结果是31
var d = new Date();
//undefined
d
//Sat Jul 02 2011 14:55:05 GMT+0800 (China Standard Time)
d.setMonth(7); //如果你这样设置月份数值,就可能跟预期的不一样的,setMonth(7)实际上是设置月份值为8月
//1312268005714
d
//Tue Aug 02 2011 14:55:05 GMT+0800 (China Standard Time)
得到的结果是29?
new Date(year, month, day, hours, minutes, seconds, ms)
Arguments
milliseconds
The number of milliseconds between the desired date and midnight on January 1, 1970
(UTC). For example, passing the argument 5000 creates a date that represents five seconds
past midnight on 1/1/70.
datestring
A single argument that specifies the date and, optionally, the time as a string. The string
should be in a format accepted by Date.parse().
year
The year, in four-digit format. For example, specify 2001 for the year 2001. For compatibility
with early implementations of JavaScript, if this argument is between 0 and 99,
1900 is added to it.
month
The month, specified as an integer from 0 (January) to 11 (December).
day
The day of the month, specified as an integer from 1 to 31. Note that this argument uses
1 as its lowest value, while other arguments use 0 as their lowest value. Optional.
hours
The hour, specified as an integer from 0 (midnight) to 23 (11 p.m.). Optional.
minutes
The minutes in the hour, specified as an integer from 0 to 59. Optional.