将下面代码按照新版php变量声明$修改function runTime var d = new Date str = ; BirthDay = new Date2022-1-3; today = new Date; timeold = todaygetTime - BirthDaygetTime; sectimeold = timeold 1000 seco
function runTime() { $d = new Date(); $str = ''; $BirthDay = new Date("2022-1-3"); $today = new Date(); $timeold = ($today->getTime() - $BirthDay->getTime()); $sectimeold = $timeold / 1000; $secondsold = floor($sectimeold); $msPerDay = 24 * 60 * 60 * 1000; $msPerYear = 365 * 24 * 60 * 60 * 1000; $e_daysold = $timeold / $msPerDay; $e_yearsold = $timeold / $msPerYear; $daysold = floor($e_daysold); $yearsold = floor($e_yearsold); //$str = $yearsold + "年"; $str .= $daysold . "天"; $str .= $d->getHours() . '时'; $str .= $d->getMinutes() . '分'; $str .= $d->getSeconds() . '秒'; return $str;
原文地址: https://www.cveoy.top/t/topic/h2z3 著作权归作者所有。请勿转载和采集!