用getSeconds()可以得到当前秒数
看到一个用getTime()得到的:
var now = new Date();
var ss = now.getTime() % 60000;
ss = (ss - (ss % 1000)) / 1000;
document.write(ss);
不大理解,请教一下
看到一个用getTime()得到的:
var now = new Date();
var ss = now.getTime() % 60000;
ss = (ss - (ss % 1000)) / 1000;
document.write(ss);
不大理解,请教一下
var ss = now.getTime() % 60000; //得到now里的时间,%6000这个得到毫秒数。
ss = (ss - (ss % 1000)) / 1000; //毫秒除1000得秒。
document.write(ss); //这个知道吧??
如:
<script type="text/javascript">var Birthday = new Date("July 21, 1983 01:15:00")
document.write(Birthday.getSeconds())</script>
返回值是:0
有什么问题么?
getTime( ) converts a date and time to a single integer. Date.getMilliseconds( ): return the milliseconds field of a Date