Results 1 to 2 of 2

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User rumen_33's Avatar
    Join Date: May:2007
    Location: Canada
    Posts: 137

    Time-Zone JS

    ,
    , . , -, . , , .
    . , 1000 . . , .
    !

    :
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
    <title>Time-Zone Clock</title>

    <script>
    function time (city, offset) {

    d = new Date();


    // converting to milliseconds, adding local time zone offset, getting UTC time in msec
    utc = d.getTime() + (d.getTimezoneOffset() * 60000);


    // creating new Date object for different city using supplied offset
    nd = new Date(utc + (3600000*offset));


    var hours = nd.getHours();
    var minutes = nd.getMinutes();
    var seconds = nd.getSeconds();

    if (hours <=9) hours = "0" + hours;
    if (minutes <=9) minutes = "0" + minutes;
    if (seconds <=9) seconds = "0" + seconds;

    return " " + city + " " + " " + ": " + hours + ":" + minutes + ":" + seconds;
    }

    //Sofia time
    setInterval("time()", 1000)
    document.write(time("", "+2"));
    </script>

    </head>

    <body>
    </body>
    </html>
    |Asus P5K Premium WiFi|Intel C2D E6750|Kingston 2x1GB@667MHz|Seagate 250GB+500GB|Coolmax CP 500W|Asus EN 8800 GTS 320MB|

  2. #2
    Bombera's Avatar
    Join Date: Jul:2001
    Location: 4EVA
    Posts: 13,833
    , , , .
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
    <title>Time-Zone Clock</title>
    
    <script>
    function time (city, offset) {
    
    d = new Date();
    
    
    // converting to milliseconds, adding local time zone offset, getting UTC time in msec
    utc = d.getTime() + (d.getTimezoneOffset() * 60000);
    
    
    // creating new Date object for different city using supplied offset
    nd = new Date(utc + (3600000*offset));
    
    
    var hours = nd.getHours();
    var minutes = nd.getMinutes();
    var seconds = nd.getSeconds();
    
    if (hours <=9) hours = "0" + hours;
    if (minutes <=9) minutes = "0" + minutes;
    if (seconds <=9) seconds = "0" + seconds;
    
    document.getElementById("clockdiv").innerHTML = "  " + city + " " + "  " + ": " + hours + ":" + minutes + ":" + seconds;
    }
    
    function bodyload(){
    	setInterval("time(\"\", \"+2\")", 1000);
    }
    </script>
    
    </head>
    
    <body onload="bodyload()">
    <div id="clockdiv"></div>
    </body>
    </html>
    . , , -.
    Last edited by Bombera; 8th November 2008 at 14:07. Reason: alert :)
    EVGA X299 FTW K|i9-7960X@4.7|4x8 Patriot Viper Steel 4000|GTX 1660 Ti|970 EVO 1 TB|Seasonic Focus GX-1000|Xigmatek Elysium|
    Rampage IV Extreme BE|E5-1680v2@4.7|4x4 HyperX 1866|Cougar Aqua 240|GTX 1050 Ti|970 EVO 1/4 TB|CM 850 SilentPro|HAF-X|

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |