function GetDateDiff(startTime, endTime, diffType) {  
	
	if(startTime=="now"){
		var d = new Date();
		var years = d.getYear();
		var month = add_zero(d.getMonth()+1);
		var days = add_zero(d.getDate());
		var hours = add_zero(d.getHours());
		var minutes = add_zero(d.getMinutes());
		var seconds=add_zero(d.getSeconds());
		var startTime = years+"-"+month+"-"+days+" "+hours+":"+minutes+":"+seconds;
		//alert(ndate);
	}

	//将xxxx-xx-xx的时间格式，转换为 xxxx/xx/xx的格式 
	startTime = startTime.replace(/\-/g, "/");  
	endTime = endTime.replace(/\-/g, "/");  
	
	
	//将计算间隔类性字符转换为小写  
	diffType = diffType.toLowerCase();  
	var sTime = new Date(startTime);      //开始时间  
	var eTime = new Date(endTime);  //结束时间  
	//作为除数的数字  
	
	var divNum = 1;
	switch (diffType) {
		case "second":
			divNum = 1000;
			break;
		case "minute":
			divNum = 1000 * 60;
			break;
		case "hour":
			divNum = 1000 * 3600;
			break;
		case "day":
			divNum = 1000 * 3600 * 24;
			break;
		default:
			break;
	}
	return parseInt((eTime.getTime() - sTime.getTime()) / parseInt(divNum));
}

function add_zero(temp)
{
	if(temp<10) return "0"+temp;
	else return temp;
}

function ShowDate(n)
{
var uom = new Date();
uom.setDate(uom.getDate()+n);
uom = uom.getFullYear() + "-" +   (uom.getMonth()+1) + "-" + uom.getDate();
return uom;
}

//var result = GetDateDiff("2012-03-15 05:15:00", "2012-03-15 10:45:00", "hour"); 
//var result = ShowDate(0)
//alert(result);