html
head
script language=JavaScript
var a,b,c;
var dateTime = new Date();
var fixTime = new Date();
fixTime.setHours(10);
fixTime.setMinutes(30);
fixTime.setSeconds(0);
var difTime=dateTime.getTime()fixTime.getTime()?dateTime.getTime()-fixTime.getTime():fixTime.getTime()-dateTime.getTime();
var t=toTime(difTime);
alert(t);
function toTime(milliSecond){
var h=parseInt(milliSecond/(60*60*1000));
var temp=milliSecond%(60*60*1000);
var m=parseInt(temp/(60*1000));
var s=parseInt((temp%(60*1000))/1000);
return (h10?0+h:h)+:+(m10?0+m:m)+:+(s10?0+s:s);
}
/script
/head
body
/body
/html
你看看,我测试是没有问题的e/
取消
评论