JavaScript 并 没 有 实 际 的 日 期 型 态, 但 是 它 却 能 毫 不 费 力 地 显 示 出 日 期 和 时 间,原 因 是 它 是 从 1 / 1 / 1970 0:0h 开 始 以 ms(milli seconds) 来 计 算 目 前 的 时 间 的,
function(a,b)
{
if(a instanceof Date && b.instanceof Date)
{
return Math.round((a.getTime() - b.getTime()) / 1000);
}
else
{
throw new Error("Argument Exception");
}
}
function(a,b)
{
if(a instanceof Date && b.instanceof Date)
{
return Math.round((a.getTime() - b.getTime()) / 1000);
}
else
{
throw new Error("Argument Exception");
}
}
{
加上这个if的总提示缺少对象?
}
alert(d1);var d2=new Date();
alert(d2);alert((d2-d1)/1000);</script>
return Math.floor( ( t2.getTime() - t1.getTime() )/1000);
}