Re: subtracting 2 time strings
| From: | Matt | Date: | Sun, 11 Aug 2002 13:27:33 +0000 |
| Subject: | Re: subtracting 2 time strings | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-112015@lists.php.net to get a copy of this message | ||
> From: "Christopher Molnar" <molnarc@pandmservices.com>
> Sent: Saturday, August 10, 2002 11:37 AM
> Subject: [PHP] subtracting 2 time strings
> Help!
>
> I can't find reference to it in the manuals but I need to subtract to
> time strings.
>
> ex:
>
> time_in = 11:00
> time_out = 13:45
>
> job_time = 2:45
Something like:
<?php
$time_in = "11:00";
$time_out = "13:45" ;
$start = strtotime($time_in);
$finish = strtotime($time_out);
$elapsed = $finish - $start;
echo 'Elapsed time was ' . gmdate('H:i:s',$elapsed) . "<br>\n";
?>