PHP timeline function, just, 1 minutes ago, 1 hours ago, a day ago
PHP common time processing functions:
Time (): Returns the current Unix timestamp?.
Date (): Formats a local time/date.
GETDATE (): Gets the date/time information.
Mktime (): normal date turn timestamp. Mktime (0, 0, 0, 9, 18, 2011)
The following is a time-axis processing function
/** * Time format */static function formatdate ($time) {$rtime = Date ("m-d h:i", $time), $htime = Date ("H:i", $time); $time = Time ()-$time, if ($time <) {$str = ' just ',} elseif ($time <) {$min = floor ($time/60); $str = $min. ' Minutes ago ';} ElseIf ($time < *) {$h = Floor ($time/(); $str = $h. ' Hours ago '. $htime;} ElseIf ($time < * * 3) {$d = Floor ($time/(per *)), if ($d = = 1) $str = ' Yesterday ' $rtime; else$str = ' The day before yesterday '. $rtime;} else {$str = $rtime;} return $str; }
?