var date = new Date;
var day=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
var str = date.getYear()+"年"+(date.getMonth()+1)+"月"+date.getDate()+"日"+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds()+" "+day[date.getDay()];
date.getMonth() 获得的月份实际是本月的上一个月,故要获得正确的月份,还需要加1
date.getDay()获得是的数字表示的星期几,依次从0~6,代表着从星期日到星期六,故可根据自己的需要处理星期