/**
* 获取时间对象
*/
function getDateObj(addDayCount) {
var dd = new Date();
dd.setDate(dd.getDate()+addDayCount);//获取addDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth()+1;//获取当前月份的日期
var d = dd.getDate();
var h = dd.getHours();
var M = dd.getMinutes();
var s = dd.getSeconds();
var w = "";
var numOfWeek = dd.getDay();
switch (numOfWeek) {
case 0: w = "星期日"; break;
case 1: w = "星期一"; break;
case 2: w = "星期二"; break;
case 3: w = "星期三"; break;
case 4: w = "星期四"; break;
case 5: w = "星期五"; break;
case 6: w = "星期六"; break;
}
var timeObject = {
'year' : y,
'month' : m,
'day' : d,
'hour' : h,
'minute': M,
'second': s,
'week' : w
}
return timeObject;
}
window.ready = function(){
var t = getDateObj(1);
alert(t.year + '-' +
t.month + '-' +
t.day + ' ' +
t.hour + ':' +
t.minute + ':' +
t.second + ' ' +
t.week);
}