显示为
本站运行:3年9月10天
<?php date_default_timezone_set('Asia/Shanghai'); function Sec2Time($time){if(is_numeric($time)){$value = array("y"=>0,"m" =>0,"d" =>0,"h" =>0,"i" =>0,"s" =>0,); if($time>=31556926){$value["y"] = floor($time/31556926);$time=($time%31556926);} if($time>=2592000){$value["m"]=floor($time/2592000);$time=($time%2592000);} if($time>=86400){$value["d"]=floor($time/86400);$time=($time%86400);} if($time>=3600){$value["h"]=floor($time/3600);$time = ($time%3600);} if($time>=60){$value["i"] = floor($time/60);$time = ($time%60);} $value["seconds"]=floor($time);return (array) $value;}else{return (bool) FALSE;}} $site_create_time = strtotime('2014-01-01'); $time = time() - $site_create_time; $sltime = Sec2Time($time); echo '本站运行:';if($sltime['y']!='0'){echo $sltime['y'].'年';}if($sltime['m']=='0' && $sltime['d']=='0'){echo '整';}if($sltime['m']!='0'){echo $sltime['m'].'月';}else{if($sltime['d']!='0'){echo '零';}}if($sltime['d']!='0'){echo $sltime['d'].'天';}?>
<div style=" width:100%; margin:0 auto; text-align:center; margin-top:100px"> <span id="span_dt_dt"></span> </div> <script> function show_date_time() { window.setTimeout("show_date_time()", 1000); BirthDay = new Date("3/11/2014 00:00:01"); today = new Date(); //总时间 timeold = (today.getTime() - BirthDay.getTime()); sectimeold = timeold / 1000 secondsold = Math.floor(sectimeold); msPerDay = 24 * 60 * 60 * 1000 e_daysold = timeold / msPerDay daysold = Math.floor(e_daysold); e_hrsold = (e_daysold - daysold) * 24; hrsold = Math.floor(e_hrsold); e_minsold = (e_hrsold - hrsold) * 60; minsold = Math.floor((e_hrsold - hrsold) * 60); seconds = Math.floor((e_minsold - minsold) * 60); span_dt_dt.innerHTML = "思源博客已运行:" + daysold + "天" + hrsold + "小时" + minsold + "分" + seconds + "秒"; } show_date_time(); </script>
实例:思源博客已运行:1279天21小时22分53秒
介绍:用于呈现各种类型媒体的javascript lightbox库。响应灵敏,触控灵活,可定制。 3.0主要就是功能多且美观 官方给出的最快使用方法 <!-- 1. Add latest...
//屏蔽F12和右键 function click(e) { if (document.all) { if (event.button==2||event.button==3) { alert("你...
首先引入jQuery js代码如下 $(function(){ //当滚动条的位置处于距顶部100像素以下时,跳转链接出现,否则消失 $(function () { ...
资源网,博客文章页面增加访问停留时间代码 <!-- 统计访客停留时间 --> <div id="tingliu"> </span> <span clas...
本文是利用js代码批量自动取消抖音所有关注 解放双手 有时候我们抖音关注的人太多,想要批量取消但是一个一个点击太麻烦了,如何解放双手批量取消关注呢?所以思源研究了一下,写了一段js代码,在线...
好久不更新了 [JS]文字逐字打出 代码如下 <!DOCTYPE html> <html> <head> <meta char...