duttydea Posted August 11, 2008 Share Posted August 11, 2008 I have a Table that store my start & finish time for Work. Work_Date Start Finish Lunch 2008-08-09 07:00:00 14:00:00 Yes 2008-08-11 07:00:00 17:00:00 Yes I have tried the code below and get 01:00 $elapsed = ($row["Finish"]) - ($row["Start"]); echo date("H:i", $elapsed); ?> Can someone help? Thanks in advance Link to comment https://forums.phpfreaks.com/topic/119196-time-elapsed-between-two-times/ Share on other sites More sharing options...
discomatt Posted August 11, 2008 Share Posted August 11, 2008 User strtotime() to convert it into a timestamp, subtract start from end, and you;'re left with the amount of seconds you've been working. Link to comment https://forums.phpfreaks.com/topic/119196-time-elapsed-between-two-times/#findComment-613879 Share on other sites More sharing options...
duttydea Posted August 11, 2008 Author Share Posted August 11, 2008 sorry!! Im a noob! how do i do that? Link to comment https://forums.phpfreaks.com/topic/119196-time-elapsed-between-two-times/#findComment-613882 Share on other sites More sharing options...
discomatt Posted August 11, 2008 Share Posted August 11, 2008 Read up on strtotime http://php.net/manual/en/function.strtotime.php Give it an attempt. If you're still not sure, reply here. Link to comment https://forums.phpfreaks.com/topic/119196-time-elapsed-between-two-times/#findComment-613889 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.