PHP output Specifies the time before the time format method, PHP time format
The example in this article describes how PHP outputs the time format before the specified time. Share to everyone for your reference. The specific analysis is as follows:
For example, you need to output PHP 3 days ago, 20 minutes ago, you can refer to the following code
Function ago ($time) {$time = Strtotime ($time), $delta = time ()-$time; if ($delta <) { return ' less than a min Ute ago. '; } else if ($delta <) { return ' about a minute ago, ';} else if ($delta <) { return floor ($delt A/60). ' minutes ago. '; } else if ($delta <) { return ' about an hour ago ';} else if ($delta < (for each) { return ') About '. Floor ($delta/3600). ' Hour (s) ago. '; } else if ($delta <) { return ' 1 day ago ';} else { return floor ($delta/86400). ' days ago. '; }}
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/970978.html www.bkjia.com true http://www.bkjia.com/PHPjc/970978.html techarticle PHP output Specifies the time before the time format method, PHP time format This article describes the PHP output time before the time format of the method. Share to everyone for your reference. Specific analysis ...