2
안녕하세요, GMT 시간을 얻으려면이 함수를 사용하고 있습니다. 자바 스크립트를 처음 사용하는 경우 getTime 함수를 호출하면 웹 페이지에서 경고가 생성됩니다. 그럼 당신이하고있는자바 스크립트를 통해 ntp 시간을 얻는 방법
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); });
보그 에밀 Mariesan 그것을 작동 –
덕분에 많이 업데이트되었습니다
– wael@BogdanEmilMariesan : 다음 getTime() 함수에 대한 코드가? – Mou