var now = newDate();
var year = now.getFullYear(); //得到年份var month = now.getMonth();//得到月份var date = now.getDate();//得到日期var day = now.getDay();//得到周几var hour = now.getHours();//得到小时var minu = now.getMinutes();//得到分钟var sec = now.getSeconds();//得到秒var MS = now.getMilliseconds();//获取毫秒
然后自己组装一下
var now = new Date(); var year = now.getFullYear(); //得到年份 var month = now.getMonth();//得到月份 var date = now.getDate();//得到日期 var day = now.getDay();//得到周几 var hour = now.getHours();//得到小时 var minu = now.getMinutes();//得到分钟 var sec = now.getSeconds();//得到秒 var MS = now.getMilliseconds();//获取毫秒 然后自己组装一下