0

我需要使用 as3 访问 IST。我不需要系统时间,因为我想要精确的 IST。我已经尝试过 getTimezoneOffset(),但它显​​示了 b/w IST 和 GMT 的差异,而与当前系统时间无关。在我的情况下,我严格需要来自互联网的 IST使用系统时间。你可以帮帮我吗?非常感谢。

4

1 回答 1

0

可能这会帮助你你想要什么。

<html>
<head>
<title>time test</title>
<script>


function getTime(zone, success) {
var url = 'http://json-time.appspot.com/time.json?tz=' + zone,
    ud = 'json' + (+new Date());
window[ud]= function(o){
    success && success(new Date(o.datetime));
};
document.getElementsByTagName('head')[0].appendChild((function(){
    var s = document.createElement('script');
    s.type = 'text/javascript';
    s.src = url + '&callback=' + ud;
    return s;
})());
}

getTime('GMT', function(time){
// This is where you do whatever you want with the time:
alert(time);
document.getElementById("time").innerHTML=time;
});
</script>
</head>
<body>
<h1 id="time"></h1>
</body>
</html>
于 2013-12-12T07:12:37.953 回答