function formatTime(time) {
	var dayTime = new Date(time);
	var now = new Date().getTime();
	var timeSpan = now - time;
	if(timeSpan / (1000 * 60 * 60 * 24 * 365) > 1) {
		return "一年前";
	} else if(timeSpan / (1000 * 60 * 60 * 24 * 182) > 1) {
		return "半年前";
	} else if(timeSpan / (1000 * 60 * 60 * 24 * 90) > 1) {
		return "三个月前";
	} else if(timeSpan / (1000 * 60 * 60 * 24) > 1) {
		return parseInt(timeSpan / (1000 * 60 * 60 * 24)) + "天前";
	} else if(timeSpan / (1000 * 60 * 60) > 1) {
		return parseInt(timeSpan / (1000 * 60 * 60)) + "小时前";
	} else if (timeSpan / (1000 * 60) > 1) {
		return parseInt(timeSpan / (1000 * 60)) + "分钟前";
	}
	return "刚刚";
}

function formatTime2(time){
	var d = new Date(time);
	s = d.getFullYear() + "-";
	s+=("0"+(d.getMonth()+1)).slice(-2) + "-";
	s+= ("0"+d.getDate()).slice(-2) + " ";
	//s+= ("0"+d.getHours()).slice(-2) + ":";	    
	//s+= ("0"+d.getMinutes()).slice(-2) + ":"	        
	//s+=("0"+d.getSeconds()).slice(-2);
	//s+= ("00"+d.getMilliseconds()).slice(-3);
	return s;
}

function formatTime1(time){
	var d = new Date(time);
	s = d.getFullYear() + "-";
	s+=("0"+(d.getMonth()+1)).slice(-2) + "-";
	s+= ("0"+d.getDate()).slice(-2) + " ";
	s+= ("0"+d.getHours()).slice(-2) + ":";	    
	s+= ("0"+d.getMinutes()).slice(-2) + ":"	        
	s+=("0"+d.getSeconds()).slice(-2);
	//s+= ("00"+d.getMilliseconds()).slice(-3);
	return s;
}
/**
 * 返回剩余时间
 * @param time
 * @returns {String}
 */
function formatTime3(time) {
	var dayTime = new Date(time);
	var now = new Date().getTime();
	var timeSpan =time-now;
	if(timeSpan / (1000 * 60 * 60 * 24 * 365) > 1) {
		return "剩余一年";
	} else if(timeSpan / (1000 * 60 * 60 * 24 * 182) > 1) {
		return "半年";
	} else if(timeSpan / (1000 * 60 * 60 * 24 * 90) > 1) {
		return "剩余三个月";
	} else if(timeSpan / (1000 * 60 * 60 * 24) > 1) {
		return "剩余"+parseInt(timeSpan / (1000 * 60 * 60 * 24)) + "天";
	} else if(timeSpan / (1000 * 60 * 60) > 1) {
		return "剩余"+parseInt(timeSpan / (1000 * 60 * 60)) + "小时";
	} else if (timeSpan / (1000 * 60) > 1) {
		return "剩余"+parseInt(timeSpan / (1000 * 60)) + "分钟";
	}
	return "已结束";
}

function formatTime4(time) {
	var str = "";
	if(time!=null && ''!=time){
		var dayTime = new Date(time);
		var now = new Date().getTime();
		var timeSpan = now - time;
		if(timeSpan / (1000 * 60 * 60 * 24) > 1) {
			str+=parseInt(timeSpan / (1000 * 60 * 60 * 24))+"天";
		} 
		if(timeSpan % (1000 * 60 * 60 * 24) > 0) {
			str+=parseInt((timeSpan % (1000 * 60 * 60 * 24))/(1000 * 60 * 60)) + "小时";
		} 
		if (timeSpan % (1000 * 60 * 60) > 0) {
			str+=parseInt((timeSpan % (1000 * 60 * 60))/(1000 * 60))+"分钟";
		}
	}
	return str;
	
}

function formatTime5(time) {
	var str = "";
	if(time!=null && ''!=time){
		if(time / (1000 * 60 * 60 * 24) > 1) {
			str+=parseInt(time / (1000 * 60 * 60 * 24))+"天";
		} 
		if(time % (1000 * 60 * 60 * 24) > 0) {
			str+=parseInt((time % (1000 * 60 * 60 * 24))/(1000 * 60 * 60)) + "小时";
		} 
		if (time % (1000 * 60 * 60) > 0) {
			str+=parseInt((time % (1000 * 60 * 60))/(1000 * 60))+"分钟";
		}
	}
	return str;
	
}