note 23315 added to ref.datetime

From: Date: Mon, 15 Jul 2002 13:50:59 +0000
Subject: note 23315 added to ref.datetime
Groups: php.notes 
Request: Send a blank email to php-notes+get-33083@lists.php.net to get a copy of this message
The simplest function for formating a timestamp difference. function date_diff ( $date1, $date2 ) { $some=date("z \\d\\a\\y\\s H\\h i\\m s\\s",$data-7200); return $some; } Where $date1 and $date2 are the timestamps you want. Ex. date_diff(1024681353, 1023917859); Will output : 8 days 20h 04m 54s If you want smater output you should have a switch(date("z", $date)) { ... } in order to avoid "1 days" ... -- http://www.php.net/manual/en/ref.datetime.php http://master.php.net/manage/user-notes.php?action=edit+23315 http://master.php.net/manage/user-notes.php?action=delete+23315 http://master.php.net/manage/user-notes.php?action=reject+23315

« previous php.notes (#33083) next »