Getting the current GMT world time

You can use JSON[P] and access a time API:

(The code below should work perfectly, just tested it…)

function getTime(zone, success) {
    var url="" + zone,
        ud = 'json' + (+new Date());
    window[ud]= function(o){
        success && success(new Date(o.datetime));
        var s = document.createElement('script');
        s.src = url + '&callback=' + ud;
        return s;

getTime('GMT', function(time){
    // This is where you do whatever you want with the time:

Leave a Comment