开发者

Getting current time via Javascript

A two-part question:

  1. What is the best way to get the current time from JavaScript?

  2. What resolution can I assume across all major platforms (including browser-capable PDAs, iPhone, etc.) -- seconds, milliseconds,开发者_如何学JAVA 1/10th of a second?

Thanks!


  1. var date = new Date();. new Date().getTime() will return you the number of milliseconds since January 1 1970.
  2. Milliseconds. It's specified as such in the ECMAScript spec.


You can refer to this page for function work for time.

http://www.quackit.com/javascript/javascript_date_and_time_functions.cfm

There may no compatible issue. Since it is standardized

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜