Subtract hours

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
proveyourselfthom
Forum Newbie
Posts: 5
Joined: Sat Aug 08, 2009 11:31 am

Subtract hours

Post by proveyourselfthom »

Hello,
for exemple, with a hour in MySQL format (hh:mm:ss), i want to subtract 02:50:35 hours from 35:00:00 hours. Is there a way to subtract hours bigger than 24 hours?
Thank you!
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Subtract hours

Post by Eran »

did you mean in PHP or SQL? you can do this to subtract hours from a timestamp:

Code: Select all

SELECT '2009-08-08 02:50:00' - INTERVAL 35 HOUR
proveyourselfthom
Forum Newbie
Posts: 5
Joined: Sat Aug 08, 2009 11:31 am

Re: Subtract hours

Post by proveyourselfthom »

I'm talking about php but this time is on db.
Thank's guys!
Post Reply