MySQL Forums
Forum List  »  PHP

difference of dates
Posted by: Joeri Jacobs
Date: June 26, 2005 01:21PM


I have a date-field in a mysql-table and I want to make the difference between this date and the date now.

I've tried this
SELECT `table`.`datefield` - now( ) AS difference FROM table;

The result I get is something crazy. For example:
- difference between now (26/06/2005 21:18) and 24/06/2005 gives me -20050606161211
- difference between now and 16/07/2005 gives me -20050606161119

Not really something usefull I think...

I would like the difference in days, so 24/06/2005 - 26/06/2005 gives me -2 days.

Someone who can help?

Thanks in advance!

Options: ReplyQuote

Written By
difference of dates
June 26, 2005 01:21PM
June 27, 2005 08:29AM
June 27, 2005 08:55AM
June 27, 2005 11:58AM

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.