编程论坛
注册
登录
编程论坛
→
JavaScript论坛
【求助】关于时间计算
reabin_1108
发布于 2011-08-19 11:41, 417 次点击
(new Date()).getTime();
得到的是一串数字。请问怎么把这串数字计算出时间啊?
2 回复
#2
外部三电铃
2011-08-19 19:11
不要用getTime(),这是求时间戳的,用下面的代码
程序代码:
<script language=Javascript>
var
now=
new
Date();
var
date = now.getYear()+"-"+(now.getMonth()+1)+"-"+now.getDate()+" "+now.getHours()+":"+now.getMinutes()+":"+now.getSeconds();
document.write(date);
</script>
#3
jimk5200
2011-08-21 07:52
版主正解
1