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 <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to