Time zones

Hi,

I have to print on one page time on 3 different time-zone:

Bahamas (GMT - 5) - Liechtenstein (GMT + 1) - Cyprus (GMT + 2)

It can be solved by JavaScript or PHP. Somebody has solution? To get GMT time and calculate relative times or ...?

Thanks.

Comments

  • Hello,

    Because it was urgent I solved it by PHP like this:

    <?php
    // Bahamas (GMT - 5) - Liechtenstein (GMT + 1) - Cyprus (GMT + 2)
    echo "<b>Bahamas ".date("(H:i)", mktime(gmdate("H")-5,gmdate("i"),gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y")))." - ";
    echo "Liechtenstein ".date("(H:i)", mktime(gmdate("H")+1,gmdate("i"),gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y")))." - ";
    echo "Cyprus ".date("(H:i)", mktime(gmdate("H")+2,gmdate("i"),gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y")))." ";
    ?>

    global:

    <?php
    echo "Times:<br>
    ";
    echo "Grinich - 7: ".date("M, d Y (H:i:s)", mktime(gmdate("H")-7,gmdate("i"),gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y")))."

    ";
    echo "Grinich - 6: ".date("M, d Y (H:i:s)", mktime(gmdate("H")-6,gmdate("i"),gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y")))."

    ";
    echo "Grinich - 5: ".date("M, d Y (H:i:s)", mktime(gmdate("H")-5,gmdate("i"),gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y")))."

    ";
    echo "Grinich - 4: ".date("M, d Y (H:i:s)", mktime(gmdate("H")-4,gmdate("i"),gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y")))."

    ";
    echo "Grinich - 3: ".date("M, d Y (H:i:s)", mktime(gmdate("H")-3,gmdate("i"),gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y")))."

    ";
    echo "Grinich - 2: ".date("M, d Y (H:i:s)", mktime(gmdate("H")-2,gmdate("i"),gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y")))."

    ";
    echo "Grinich - 1: ".date("M, d Y (H:i:s)", mktime(gmdate("H")-1,gmdate("i"),gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y")))."

    ";
    echo "Grinich + 0: ".date("M, d Y (H:i:s)", mktime(gmdate("H")+0,gmdate("i"),gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y")))."

    ";
    echo "Grinich + 1: ".date("M, d Y (H:i:s)", mktime(gmdate("H")+1,gmdate("i"),gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y")))."

    ";
    echo "Grinich + 2: ".date("M, d Y (H:i:s)", mktime(gmdate("H")+2,gmdate("i"),gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y")))."

    ";
    echo "Grinich + 3: ".date("M, d Y (H:i:s)", mktime(gmdate("H")+3,gmdate("i"),gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y")))."

    ";
    echo "Grinich + 4: ".date("M, d Y (H:i:s)", mktime(gmdate("H")+4,gmdate("i"),gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y")))."

    ";
    echo "Grinich + 5: ".date("M, d Y (H:i:s)", mktime(gmdate("H")+5,gmdate("i"),gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y")))."

    ";
    echo "Grinich + 6: ".date("M, d Y (H:i:s)", mktime(gmdate("H")+6,gmdate("i"),gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y")))."

    ";
    echo "Grinich + 7: ".date("M, d Y (H:i:s)", mktime(gmdate("H")+7,gmdate("i"),gmdate("s"),gmdate("m"),gmdate("d"),gmdate("Y")))."

    ";
    ?>

    Regards

    LJUBA
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion