CSS > 新さっぽろ60+One

JavaScript

8.日付・時刻<59_211p>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>協定世界時(UTC)を参照したい</title>
</head>
<body>
<p>■協定世界時(UTC)を参照したい</p>
<script type="text/JavaScript">
<!--
today = new Date();
gggg = today.getUTCFullYear();
mo = today.getUTCMonth()+1;//実際の月より1少ないので注意
dd = today.getUTCDate();
hh = today.getUTCHours();
mn = today.getUTCMinutes();
ss = today.getUTCSeconds();
ms = today.getUTCMilliseconds();
document.write("<p>現在の協定世界時(UTC)は<b>"+gggg+"年"+mo+"月"+dd+"日 "+hh+"時"+mn+"分"+ss+"秒"+ms+"ミリ秒</b>です。</p>");
document.write("<p>ちなみにローカル日時は"+today.toLocaleString()+"です。</p>");
// -->
</script>
</body>
</html>


協定世界時(UTC)を参照したい