Ver 8.0, Distrib 3.22.32.

I have two fields in a table that are TIMESTAMP fields.  I'd like to show 
the amount of elapsed time between the two timestamps in a human readable 
format.  For example, I'd like to print 'Elapsed time: 1 year 4 months 27 
days 9 hours 13 minutes 42 seconds. '  Or perhaps 1-4-27 9:13:42.

I've tried
SELECT SEC_TO_TIME(date2 - date1) from myfile
Differences of more than 24 hours appear to accumulate in the hours field - 
it show things like 225:18:07.

I've also tried
select FORMAT_DATE((date2 - date1), '%Y-%c-%e %T') from myfile.
most records return NULL..

Can an SQL query calculate and display the elapsed time?  If so, could you 
provide a simple example?  If this isn't feasible, I can certainly 
calculate the difference in the code if need be.

Thank you.

Regards,
Rich


---------------------------------------------------------------------
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