﻿function time_beijing() {
    var now;
    var h, m, s, year, month, day;
    now = new Date();
    year = now.getFullYear();
    month = now.getMonth() + 1;
    day = now.getDate();
    
    h = now.getHours();
    m = now.getMinutes();
    s = now.getSeconds();
    month = ((month < 10) ? "0" : "") + month;
    day = ((day < 10) ? "0" : "") + day;
    h = ((h < 10) ? "0" : "") + h;
    m = ((m < 10) ? "0" : "") + m;
    s = ((s < 10) ? "0" : "") + s;
    document.getElementById("beijing").innerHTML = year + "-" + month + "-" + day + " " + h + ":" + m + ":" + s;
    //document.all.beijing.innerHTML = year + "-" + month + "-" + day + " " + h + ":" + m + ":" + s;
    setTimeout("time_beijing()", 1000);
}

function time_london() {
    var now;
    var h, m, s, year, month, day;
    now = new Date();
    year = now.getUTCFullYear();
    month = now.getUTCMonth() + 1;
    day = now.getUTCDate();
    h = now.getUTCHours();
    h -= -0;
    if (h < 0)
    { h += 24; }
    m = now.getUTCMinutes();
    s = now.getUTCSeconds();
    month = ((month < 10) ? "0" : "") + month;
    day = ((day < 10) ? "0" : "") + day;
    h = ((h < 10) ? "0" : "") + h;
    m = ((m < 10) ? "0" : "") + m;
    s = ((s < 10) ? "0" : "") + s;
    document.getElementById("london").innerHTML = year + "-" + month + "-" + day + " " + h + ":" + m + ":" + s;
    setTimeout("time_london()", 1000);
}

function time_newyork() {
    var now;
    var h, m, s, year, month, day;
    now = new Date();
    year = now.getFullYear();
    month = now.getMonth() + 1;
    day = now.getDate();
    h = now.getHours();
    h -= 13;
    if (h < 0)
    { h += 24; }
    m = now.getMinutes();
    s = now.getSeconds();
    month = ((month < 10) ? "0" : "") + month;
    day = ((day < 10) ? "0" : "") + day;
    h = ((h < 10) ? "0" : "") + h;
    m = ((m < 10) ? "0" : "") + m;
    s = ((s < 10) ? "0" : "") + s;

    document.getElementById("newyork").innerHTML = year + "-" + month + "-" + day + " " + h + ":" + m + ":" + s;
    setTimeout("time_newyork()", 1000);
}