$(function () {
var mydate = new Date();
//获取完整的年份(4位,1970-????)
mydate.getFullYear();
//获取当前月份(0-11,0代表1月)
mydate.getMonth();
//获取当前日(1-31)
mydate.getDate();
//获取当前星期X(0-6,0代表星期天)
mydate.getDay();
//获取当前时间(从1970.1.1开始的毫秒数)
mydate.getTime();
//获取当前小时数(0-23)
mydate.getHours();
//获取当前分钟数(0-59)
mydate.getMinutes();
//获取当前秒数(0-59)
mydate.getSeconds();
//获取当前年月日
var TimeDate = mydate.getFullYear() + "-" + mydate.getMonth() + 1 + "-" + mydate.getDay();
//获取时分秒
var NowTime = mydate.getHours() + "-" + mydate.getMinutes() + "-" + mydate.getSeconds();
alert(TimeDate);
alert(NowTime);
});