var weeks = new Array('日', '月', '火', '水', '木', '金', '土'); var d = new Date(); // 年月日・曜日・時分秒の取得 var year = d.getFullYear(); var month = d.getMonth() + 1; var day = d.getDate(); var week = weeks[ d.getDay() ]; var hour = d.getHours(); var minute = d.getMinutes(); var second = d.getSeconds(); // 1桁を2桁に変換する if (month < 10) {month = "0" + month;} if (day < 10) {day = "0" + day;} if (hour < 10) {hour = "0" + hour;} if (minute < 10) {minute = "0" + minute;} if (second < 10) {second = "0" + second;} alert( year + " " + month + " " + day + " " + week + hour + ":" + minute + ":" + second);