3 回答


熊熊不咆哮
TA贡献2条经验 获得超0个赞
JavaScript获取时间后以指定格式输出一般就是用Date对象的api分别获取部分,然后拼接起来。第二种方法就是下面这个了。 var d = new Date(); new Date(d.getTime() - d.getTimezoneOffset() * 60000).toISOString().replace("T", " ").replace(/\..+$/,"");

慕标8001392
TA贡献2条经验 获得超2个赞
var
times =
new
Date();
time = now.getFullYear()+
"/"
+((now.getMonth()+1)<10?
"0"
:
""
)+(now.getMonth()+1)+
"/"
+(now.getDate()<10?
"0"
:
""
)+now.getDate()+
" "
+now.getHours()+
":"
+now.getMinutes()+
":"
+now.getSeconds();
alert(times);
alert(time);

慕神0244720
TA贡献2条经验 获得超0个赞
var now = new Date(); time = now.getFullYear()+"/"+((now.getMonth()+1)<10?"0":"")+(now.getMonth()+1)+"/"+(now.getDate()<10?"0":"")+now.getDate()+" "+now.getHours()+":"+now.getMinutes()+":"+now.getSeconds();
这是用javaScript实现的。
添加回答
举报
0/150
提交
取消