欧美一级色视频,簧片在线免费看,美日韩在线,成人观看网站a,亚洲欧美在线一区二区,欧美操穴,欧美综合专区

龍巖易富通網(wǎng)絡科技有限公司

龍巖小程序開發(fā),龍巖分銷系統(tǒng)

php幾分鐘前,幾小時前,幾天前時間顯示函數(shù)(2)

2015.09.10 | 770閱讀 | 0條評論 | php

考慮時區(qū): [php] function time_tran($the_time){? $the_time=date('Y-m-d H:i:s',$the_time);? $now_time = date("Y-m-d H:i:s",time()+8*60*60);? $now_time = strtotime($now_time);? $show_time = strtotime($the_time);? $dur = $now_time - $show_time;? if($dur < 0){? ?return $the_time;? }else{? ?if($dur < 60){? ? return $dur.'秒前';? ?}else{? ? if($dur < 3600){? ? ?return floor($dur/60).'分鐘前';? ? }else{? ? ?if($dur < 86400){? ? ? return floor($dur/3600).'小時前';? ? ?}else{? ? ? if($dur < 259200){//3天內? ? ? ?return floor($dur/86400).'天前';? ? ? }else{? ? ? ?return $the_time;? ? ? }? ? ?}? ? }? ?}? }} [/php] 不考慮時區(qū): [php] function time_tran($the_time){? $the_time = date("Y-m-d H:i:s",$the_time);? $now_time = date("Y-m-d H:i:s");? $now_time = strtotime($now_time);? $show_time = strtotime($the_time);? $dur = $now_time - $show_time;? if($dur < 60){? ?return $dur.'秒前';? }else{? ?if($dur < 3600){? ? return floor($dur/60).'分鐘前';? ?}else{? ? if($dur < 86400){? ? ?return floor($dur/3600).'小時前';? ? }else{? ? ?if($dur < 259200){//3天內? ? ? return floor($dur/86400).'天前';? ? ?}else{? ? ? return $the_time;? ? ?}? ? }? ?}? }} [/php]

贊 (

發(fā)表評論

浮梁县| 广饶县| 西城区| 毕节市| 新竹县| 太仆寺旗| 会理县| 安康市| 邵武市| 工布江达县| 贵定县| 渝中区| 万山特区| 明光市| 天水市| 新干县| 金坛市| 景洪市| 平泉县| 西乌珠穆沁旗| 固原市| 齐齐哈尔市| 华池县| 镇宁| 海兴县| 安义县| 杂多县| 常熟市| 焉耆| 贵德县| 江津市| 亳州市| 江阴市| 信阳市| 民丰县| 中山市| 越西县| 外汇| 南宁市| 邳州市| 伊金霍洛旗|