日期:2014-05-18 浏览次数:20691 次
把createtime做为参数传进去就好了
function dateFormat(time){
if(!time){
return "";
}
var tmp = eval(time);
var date = new Date();
date.setTime(tmp.time);
var year = date.getYear();
var month = date.getMonth() + 1;
var day = date.getDate(); //获取当前日(1-31)
/*var hour = date.getHours(); //获取当前小时数(0-23)
var minute = date.getMinutes(); //获取当前分钟数(0-59)
var second = date.getSeconds(); //获取当前秒数(0-59)*/
month=month<10?("0"+month):month;
day=day<10?("0"+day):day;
/*hour=hour<10?("0"+hour):hour;
minute=minute<10?("0"+minute):minute;
second=second<10?("0"+second):second;*/
var dateStr = year + "-" + month + "-" + day;
//dateStr = dateStr + " " + hour + ":" + minute + ":" + second;
return dateStr;
}