mysql or php timestamp arithmatic

From: Date: Mon, 25 Aug 2003 12:06:07 +0000
Subject: mysql or php timestamp arithmatic
Groups: php.general 
Request: Send a blank email to php-general+get-160673@lists.php.net to get a copy of this message
Hey everyone, I am writing an application to keep track of employee vacation leave. I have two timestamp(14) database fields, lets call them start and end, signifying when start and end of a vacation leave, respectively. What I am trying to do is get the number of hours between start and end, for example if vacation started at 12pm on wednesday and ended at 5 pm wednesday, then the total should be 5 hours (Of course the date ranges are going to be alot more complicated than that). I attempted to solve this problem in the query, using the following: FLOOR((end-start)/3600) as hours but the values that I am getting are wrong. For example, on what should be a 5 hour span, I am getting back the value 13. Any ideas? Christian

« previous php.general (#160673) next »