note 31478 deleted from function.strtotime by sniper

From: Date: Tue, 21 Oct 2003 11:02:15 +0000
Subject: note 31478 deleted from function.strtotime by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-59002@lists.php.net to get a copy of this message
Note Submitter: patrick®bierans°de ---- <?php $start="2003-04-23 15:12:59"; $end ="2003-04-25 14:12:29"; $interval=strtotime($end)-strtotime($start); echo $interval."\n"; print_r(interval_as_array($interval)); function interval_as_array($sec) { $min=0; $hour=0; $day=0; $year=0; if ($sec>60) { $min=floor($sec/60); $sec-=$min*60; } if ($min>60) { $hour=floor($min/60); $min-=$hour*60; } if ($hour>24) { $day=floor($hour/24); $hour-=$day*24; } if ($day>365) { $year=floor($day/365); $day-=$year*365; } return array('y'=>$year,'d'=>$day,'h'=>$hour,'m'=>$min,'s'=>$sec); } // interval_as_array() ?>

« previous php.notes (#59002) next »