【发布时间】:2011-08-11 23:11:45
【问题描述】:
格林尼治标准时间伊朗-德黑兰是+3:30,但为什么是这个网站:http://wwp.greenwichmeantime.com/time-zone/asia/iran/tehran/ 将格林尼治标准时间用于伊朗-德黑兰+4:30。
如何在伊朗更改 GMT 时设置自己的时钟(在我的代码中)?
我的代码: http://jsfiddle.net/HZmPg/1/
var int=self.setInterval("clock()",1000);
function clock()
{
var d=calcTime('+3')
var t=d.toLocaleTimeString();
document.getElementById("clock").innerHTML=t;
}
function calcTime(offset) {
// create Date object for current location
d = new Date();
// convert to msec
// add local time zone offset
// get UTC time in msec
utc = d.getTime() + (d.getTimezoneOffset() * 60000);
// create new Date object for different city
// using supplied offset
nd = new Date(utc + (3600000*offset));
// return time as a string
return nd;
}
尊重
【问题讨论】:
-
德黑兰是否遵守夏令时?
-
我该怎么办?请帮帮我!!!!!!!
标签: javascript jquery