Time Zone get local time - Javascript Date Operation

Javascript examples for Date Operation:Minute

Description

Time Zone get local time

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){// ww w . j av a2  s .  co  m
function calcTime(offset) {
    var d = new Date();
    var utc = d.getTime() + (d.getTimezoneOffset() * 60000);
    var nd = new Date(utc + (1000*offset));
    document.getElementById("output").innerHTML =
        "The local time is " + nd.toLocaleString();
}
calcTime(-28800.0);
    }

      </script> 
   </head> 
   <body> 
      <p id="output"></p>  
   </body>
</html>

Related Tutorials