JS时间格式化(短日期),如new Date() 转成2010-08-05
function ChangeDateToString(DateIn){
var Year = 0;
var Month = 0;
var Day = 0;
var CurrentDate = "";
Year = DateIn.getFullYear();
Month = DateIn.getMonth()+1;
Day = DateIn.getDate();
CurrentDate = Year + "-";
if (Month >= 10 ){
CurrentDate = CurrentDate + Month + "-";
} else{
CurrentDate = CurrentDate + "0" + Month + "-";
}
if (Day >= 10 ){
CurrentDate = CurrentDate + Day ;
} else{
CurrentDate = CurrentDate + "0" + Day ;
}
return CurrentDate;
}