billgod Posted September 30, 2011 Share Posted September 30, 2011 I have a datetime table in my db. my time stamps look like this 2011-09-28 16:34:03 My question is this If I have a time in of 2011-09-28 10:34:03 and a time out of 2011-09-28 18:04:03 how can I figure out the hours worked? Any help is appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/248205-time-question/ Share on other sites More sharing options...
xyph Posted September 30, 2011 Share Posted September 30, 2011 Do you want this rounded down? SELECT TIMESTAMPDIFF( HOUR, `start`, `end` ) as `hours` FROM `table` If not SELECT TIMESTAMPDIFF( SECOND, `start`, `end` ) / (60*60) as `hours` FROM `table` Quote Link to comment https://forums.phpfreaks.com/topic/248205-time-question/#findComment-1274542 Share on other sites More sharing options...
billgod Posted October 1, 2011 Author Share Posted October 1, 2011 EXACTLY what I was looking for ... Thanks a million. Quote Link to comment https://forums.phpfreaks.com/topic/248205-time-question/#findComment-1274682 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.