JavaScript入門–現在の日時をリアウタイム表示する

JavaScriptコード:
<script type="text/javascript">
function currentTimeGet()
{
var date=new Date();
var year=date.getFullYear();
var month=date.getMonth()+1;
var day=date.getDate();
var hour="00″+date.getHours();
hour=hour.substr(hour.length-2);
var minute="00″+date.getMinutes();
minute=minute.substr(minute.length-2);
var second="00″+date.getSeconds();
second=second.substr(second.length-2);
var week=date.getDay();
switch(week)
{
case 1:week="月曜日";break;
case 2:week="火曜日 “;break;
case 3:week="水曜日 “;break;
case 4:week="木曜日 “;break;
case 5:week="金曜日 “;break;
case 6:week="土曜日 “;break;
case 0:week="日曜日 “;break;
default:week="";break;
}
document.getElementById(“divBottom").innerHTML=year+"年"+month+"月"+day+"日"+" “+hour+":"+minute+":"+second+" “+week;
}
setInterval(“currentTimeGet()",1000);
</script>

JavaScript

Posted by arkgame