MySQL Forums
Forum List  »  Newbie

Difference in days between two dates
Posted by: Mike Tompson
Date: November 11, 2015 04:35PM

I'm trying to find the days pasted between two dates.
I have the command correct, but the the result's formatting is wrong or I'm just doing something wrong.

Here is what I have:

SELECT ORDER_NUM, SYSDATE() AS TODAYS_DATE, ORDER_DATE, ROUND(SYSDATE() - ORDER_DATE,2) AS DAYS_PAST
FROM ORDERS;

RESULT:
'51608', '2015-11-11 17:21:58', '2015-10-12', '20151091021146'

'20151091021146' should be 30.53

I can get the correct results by using DATEDIFF(), but it removes the decimals, and I really need the decimals.

Any suggestions?

Options: ReplyQuote


Subject
Written By
Posted
Difference in days between two dates
November 11, 2015 04:35PM


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.