当前位置:首页 > 黑客接单 > 正文内容

php js 实例分享实现显示网站运行时间 - 显示年月日时分秒

访客3年前 (2022-04-21)黑客接单535

分享二个版原的网站运转空儿代码 

PHP版原

隐示为

原站运转: 三年 九月 一0地 <必修php date_default_timezone_set('Asia/Shanghai'); function Sec 二Time($time){if(is_numeric($time)){$value = array("y"=>0,"m"大众=>0,"d"大众=>0,"h"大众=>0,"i"大众=>0,"s公众=>0,); if($time>= 三 一 五 五 六 九 二 六){$value["y"] = floor($time/ 三 一 五 五 六 九 二 六);$time=($time% 三 一 五 五 六 九 二 六);} if($time>= 二 五 九 二000){$value["m"]=floor($time/ 二 五 九 二000);$time=($time% 二 五 九 二000);} if($time>= 八 六 四00){$value["d"]=floor($time/ 八 六 四00);$time=($time% 八 六 四00);} if($time>= 三 六00){$value["h"]=floor($time/ 三 六00);$time = ($time% 三 六00);} if($time>= 六0){$value["i"] = floor($time/ 六0);$time = ($time% 六0);} $value["seconds"]=floor($time);return (array) $value;}else{return (bool) FALSE;}} $site_create_time = strtotime(' 二0 一 四-0 一-0 一'); $time = time() - $site_create_time; $sltime = Sec 二Time($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'].'地';}必修>

JS版原


<div style=公众width: 一00%; margin:0 auto; text-align:center; margin-top: 一00px"> <span id="span_dt_dt"></span> </div> <script> function show_date_time() { window.setTimeout("show_date_time()",  一000); BirthDay = new Date(" 三/ 一 一/ 二0 一 四 00:00:0 一"); today = new Date(); //总空儿 timeold = (today.getTime() - BirthDay.getTime()); sectimeold = timeold /  一000 secondsold = Math.floor(sectimeold); msPerDay =  二 四 *  六0 *  六0 *  一000 e_daysold = timeold / msPerDay daysold = Math.floor(e_daysold); e_hrsold = (e_daysold - daysold) *  二 四; hrsold = Math.floor(e_hrsold); e_minsold = (e_hrsold - hrsold) *  六0; minsold = Math.floor((e_hrsold - hrsold) *  六0); seconds = Math.floor((e_minsold - minsold) *  六0); span_dt_dt.innerHTML = "思源专客未运转:公众+ daysold + "地"大众+ hrsold + "小时"大众+ minsold + "分"大众+ seconds + "秒"; } show_date_time(); </script>


真例:思源专客未运转: 一 二 七 九地 二 一小时 二 二分 五 三秒

分享给朋友:

评论列表

萌懂依疚
3年前 (2022-06-28)

daysold = timeold / msPerDay daysold = Math.floor(e_daysold); e_hrsold = (e_daysold - daysold) *  二 四; hrsold = Math.floor(e_hr

慵吋路弥
3年前 (2022-06-27)

eric($time)){$value = array("y"=>0,"m"大众=>0,"d"大众=>0,"h"大众=>0,"i"大众=>0,"s公众=>0,);if($time>= 三 一 五 五 六 九 二 六)

鸠骨眉妩
3年前 (2022-06-27)

span_dt_dt.innerHTML = "思源专客未运转:公众+ daysold + "地"大众+ hrsold + "小时"大众+ minsold + "分"大众+ seconds + "秒";

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。