//计算时间差
function
datediff(interval, date1, date2)
{
var objInterval = {'D':1000 * 60 * 60 * 24,'H':1000 * 60 * 60,'M':1000 * 60,'S':1000,'T':1};
interval = interval.toUpperCase();
var dt1 = new Date(Date.parse(date1.replace(/-/g, '/')));
var dt2 = new Date(Date.parse(date2.replace(/-/g, '/')));
try
{
//alert(dt2.getTime() - dt1.getTime());
//alert(eval_r('objInterval.'+interval));
//alert((dt2.getTime() - dt1.getTime()) / eval_r('objInterval.'+interval));
return Math.round((dt2.getTime() - dt1.getTime()) / eval_r('objInterval.'+interval));
}
catch (e)
{
return e.message;
}
}