本站已稳定运行了 <strong><script language="JavaScript" type="text/javascript"> var urodz= new Date("9/25/2015"); var now = new Date(); var ile = now.getTime() - urodz.getTime(); var dni = Math.floor(ile / (1000 * 60 * 60 * 24)); document.write(+dni) </script> </strong>天
<script> var mydate=new Date() var year=mydate.getYear() if (year < 1000) year+=1900 var day=mydate.getDay() var month=mydate.getMonth() var daym=mydate.getDate() if (daym<10) daym="0"+daym var dayarray=new Array("星期天","星期一","星期二","星期三","星期四","星期五","星期六") var montharray=new Array("1","2","3","4","5","6","7","8","9","10","11","12") document.write(year+"年"+montharray[month]+"月"+daym+"日"+" "+dayarray[day]) </script>
<div id="timetxt"></div> <script> function startTime(){ var today=new Date(); var h=today.getHours(); var m=today.getMinutes(); var s=today.getSeconds(); h=checkTime(h); m=checkTime(m); s=checkTime(s); document.getElementById("timetxt").innerHTML=h+"时"+m+"分"+s+"秒"; t=setTimeout(function(){ startTime(); },1000); } function checkTime(i){ if(i<10){ i="0"+i; } return i; } </script>
然后在header.php的找到,然后在里面加上
1 | onload= "startTime()" |
如下:
然后保存即可。刷新一下页面,你就会看到效果。
微信号:gaogaojie5
添加微信好友, 获取更多信息
复制微信号
添加微信好友, 获取更多信息
复制微信号
搞定。
<script language=javascript> function siteTime(){ window.setTimeout("siteTime()", 1000); var seconds = 1000; var minutes = seconds * 60; var hours = minutes * 60; var days = hours * 24; var years = days * 365; var today = new Date(); var todayYear = today.getFullYear(); var todayMonth = today.getMonth()+1; var todayDate = today.getDate(); var todayHour = today.getHours(); var todayMinute = today.getMinutes(); var todaySecond = today.getSeconds(); /* Date.UTC() -- 返回date对象距世界标准时间(UTC)1970年1月1日午夜之间的毫秒数(时间戳) year - 作为date对象的年份,为4位年份值 month - 0-11之间的整数,做为date对象的月份 day - 1-31之间的整数,做为date对象的天数 hours - 0(午夜24点)-23之间的整数,做为date对象的小时数 minutes - 0-59之间的整数,做为date对象的分钟数 seconds - 0-59之间的整数,做为date对象的秒数 microseconds - 0-999之间的整数,做为date对象的毫秒数 */ var t1 = Date.UTC(2018,09,16,00,00,00); //北京时间2017-09-16 00:00:00创建网站的时间 var t2 = Date.UTC(todayYear,todayMonth,todayDate,todayHour,todayMinute,todaySecond); var diff = t2-t1; var diffYears = Math.floor(diff/years); var diffDays = Math.floor((diff/days)-diffYears*365); var diffHours = Math.floor((diff-(diffYears*365+diffDays)*days)/hours); var diffMinutes = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours)/minutes); var diffSeconds = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours-diffMinutes*minutes)/seconds); document.getElementById("sitetime").innerHTML=+diffYears+"年"+diffDays+"天"+diffHours+"时"+diffMinutes+"分钟"+diffSeconds+"秒"; } siteTime(); </script>
转载声明:本站发布文章及版权归原作者所有,转载本站文章请注明文章来源!