1 function current(){ 2 var d=new Date(),str=''; 3 var date=((d.getMonth()+1)*30+(d.getFullYear())*365+d.getDate()-(2014*365+7*30+10));//当前天数-要设置时间的天数 4 str+="已存在:"+date+"天,"; 5 var Hours=date*24+d.getHours()-12;//12为从几点开始,24小时制 6 str+=Hours+"小时,"; 7 var Minutes=Hours*60+d.getMinutes()-0//0为从几分钟开始 8 str+=Minutes+"分钟,"; 9 var Seconds=Minutes*60+d.getSeconds()-0;//0为从几秒钟开始 10 str+=Seconds+"秒钟,"; 11 //str +=d.getDay()+'周'; 12 return str; } 13 14 setInterval(function(){$("#nowTime").html(current)},1000);