📄 utc.js
字号:
// create a new Date object
var now = new Date();
// get local time in hours
var hh = now.getHours();
// get the Universal time in hours
var utc_hh = now.getUTCHours();
// get minutes and seconds
var mn = now.getMinutes();
var ss = now.getSeconds();
// ensure there are two digits for the minute value
if( mn <= 9 ) mn = "0" +mn;
// display both times
var wet = "Athens time: "+hh+": "+mn+": "+ss+"\n\n";
var utc = "Universal time: "+utc_hh+": "+mn+": "+ss;
alert( wet + utc );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -