Getting current time via Javascript
A two-part question:
What is the best way to get the current time from JavaScript?
What resolution can I assume across all major platforms (including browser-capable PDAs, iPhone, etc.) -- seconds, milliseconds,开发者_如何学JAVA 1/10th of a second?
Thanks!
var date = new Date();
.new Date().getTime()
will return you the number of milliseconds since January 1 1970.- 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
精彩评论