MySQL Forums
Forum List  »  Newbie

Re: DATE + CURRENT_TIMESTAMP for expiration
Posted by: Xyem TDS
Date: February 21, 2006 10:03PM

Instead of using CURRENT_TIMESTAMP() you could use UNIX_TIMESTAMP() which is the number of seconds since Unix Epoch ( 00:00:00 UTC on January 1, 1970 ). Then for the expires you just have the number of seconds in a day, month, year ( or 0 for never ).

Then to get expired data you would run:

SELECT columns FROM table WHERE UNIX_TIMESTAMP() > ( started + expires ) AND expires <> 0

Options: ReplyQuote


Subject
Written By
Posted
February 21, 2006 09:09PM
Re: DATE + CURRENT_TIMESTAMP for expiration
February 21, 2006 10:03PM


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.