MySQL Forums
Forum List  »  General

Re: Problem in subracting date
Posted by: Harrison Fisk
Date: October 10, 2004 04:46PM

Hi,

In order to properly subtract a date, you should use either:

1. TIMESTAMPDIFF(...)
This is a new function designed to do exactly what you want to do. However it is only available in MySQL 5.0.

2. UNIX_TIMESTAMP(newdate) - UNIX_TIMESTAMP(olddate)
This will return the difference in seconds between two different datetimes. It should work in mos versions of MySQL, as the function has been around for a while.

Regards,

Harrison

Options: ReplyQuote


Subject
Written By
Posted
October 10, 2004 01:53AM
Re: Problem in subracting date
October 10, 2004 04:46PM


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.