var dd = new Date();
var AddDayCount = 0; //0 今天 1 明天 -1 昨天
以此类推
dd.setDate(dd.getDate() + AddDayCount);//获取AddDayCount天后的日期
var y =
dd.getYear();
var m = dd.getMonth() + 1;//获取当前月份的日期
var d =
dd.getDate();
y = y < 1900 ? (y + 1900) : y;
alert(y +
"-" + m + "-" + d);
var oldTime = (new Date()).getTime(); //得到毫秒数
alert(oldTime);
var newTime = new Date(oldTime);
var
year = newTime.getYear() < 1900 ? newTime.getYear() + 1900 :
newTime.getYear(); //浏览器兼容问题
alert(year + "-" + (newTime.getMonth()+1) +
"-" + newTime.getDate());