javascript - How to get the real UTC timestamp (client independent)? -


is there way real current utc timestamp without being dependent on client's time might not set correctly on every client?

i know javascript's gettime() can utc timestamp in milliseconds. it's independent of client's timezone, think it's dependent of client's current time.

i'm trying make live clock shows real utc time, shouldn't matter if client's time set correctly or not correct.

get json:

http://json-time.appspot.com/time.json 

or

http://www.timeapi.org/utc/now 

also can own server if have one.

for example of first 1 (with interval):

html:

<div id="time">click button</div> <button id="gettime">get time</button> 

javascript (with jquery):

$("#gettime").click(function() { setinterval(ajaxcalltogettime, 1000); });   function ajaxcalltogettime() { $.ajax({ type: "get",     url: 'http://json-time.appspot.com/time.json',     datatype: 'jsonp' }) .done(function( msg ) {     $("#time").html(msg.hour + ":" + msg.minute + ":" + msg.second ); }); 

jsfiddler: http://jsfiddle.net/op8xdsrv/


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -