MySQL Forums
Forum List  »  Newbie

Calculating TIME ELAPSED SINCE in days OR hours OR minutes
Posted by: Dan LeGate
Date: February 26, 2009 06:48PM

Hi all,

I need to be able to display how many days OR hours OR minutes have elapsed by comparing a particular datetime field's date to NOW.

The reason I emphasize OR between each one is that I do NOT need to see:

3 days, 2 hours, 4 minutes.

All I would need to show is "3 days" if it's more than 24 hours.

And all I need to show is "X hours" if it's over 60 mintues and under 24 hours, and if it's under 60 minutes, I would simply show the minutes that have passed.

Does that make sense? In other words, I probably don't need all the complicated calculations found in this thread:

http://forums.mysql.com/read.php?10,135570,135726#msg-135726

but being a Newbie, I wouldn't know exactly what to exclude/change from that very intimidating example.

Any help would be MUCH appreciated.

Thanks!

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.