如何使用jQuery获取当前时间 [英] How to get current time with jQuery
本文介绍了如何使用jQuery获取当前时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面的时间以微秒为单位,例如4565212462。
The following returns time in microseconds, for example 4565212462.
alert( $.now() );
如何将其转换为人类可读的时间格式,例如(小时:分钟:秒)?
How do I convert it to a human readable time format, such as (hours:minutes:seconds)?
推荐答案
您可以这样尝试:
new Date($.now());
还可以使用Javascript这样做:
Also using Javascript you can do like this:
var dt = new Date();
var time = dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds();
这篇关于如何使用jQuery获取当前时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文