Thanks for the quick response. The times are stored in TIME format. If I do the following:
SELECT *, time_out-time_in as job_time from time_sheet; the job_time column gives me the right time, but is not formatted, for example: time_in = 11:00 time_out = 13:15 job_time= 21500 Any pointers? -Chris On Saturday, August 10, 2002, at 09:36 AM, DL Neil wrote: > Hello Christopher, > >> I need to ask for some help and I can't find anything in the manuals. I >> am writing a php based app that as one of it's functions keeps an >> employee time sheet. The times are stored in a mysql database with 2 >> columns - time_in and time_out. What I need to do is subtract these to >> columns to show a job_time (which should be in hh:mm form). >> >> Can anyone give me any suggestions? Or am I better off doing this on >> the >> PHP side rather than the mysql side? > > > My general rule is that when pulling data out of an RDBMS it is best to > do > as much as possible there, than to transfer data into (say) PHP and > post-process it. > > Are the times stored as DATETIME/TIME, timestamp, or other format data? > The > answer will thus vary! Assuming we're not talking about timestamps > (trivial > exercise) then SEC_TO_TIME() and its counterpart may be of interest. > Manual > ref: http://www.mysql.com/doc/en/Date_and_time_functions.html > > Regards, > =dn > > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <mysql-unsubscribe- > [EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php