note 42775 added to function.date
| From: | fariz at datasynx dot com | Date: | Fri, 28 May 2004 18:20:18 +0000 |
| Subject: | note 42775 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-70250@lists.php.net to get a copy of this message | ||
########################################
# To divide $hours ( HH:ii ) - $hours ( HH:ii )
########################################
function div_hours ( $start , $end ) {
$hr_start = explode (":",$start);
$hr_end = explode (":",$end);
$hr_total_start = ( $hr_start[0] * 60 ) + $hr_start[1] ;
$hr_total_end = ( $hr_end[0] * 60 ) + $hr_start[1];
if ( $hr_total_start <= $hr_total_end ) {
$len = $hr_total_end - $hr_total_start ;
} else {
$len = ( $hr_total_end + 1440 ) - $hr_total_start ;
}
$result_h = floor( $len / 60 );
$result_i = $len % 60 ;
$total_result = $result_h.":".$result_i ;
return $total_result;
}
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42775
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42775&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42775&report=yes
Search -- http://master.php.net/manage/user-notes.php