MySQL Forums
Forum List  »  Newbie

Re: how to insert a date to come ?
Posted by: Felix Geerinckx
Date: June 10, 2005 12:02PM

mathieu wrote:

> I'd like to insert the date of upcoming events in a datetime field.
> Is it possible to use something like :
> INSERT INTO mytable(event,date)
> values('name',DATE_FORMAT(UNIX_TIMESTAMP(NOW())+3600*24*15,'%Y-%m-%d %h:%i:%s'))

INSERT INTO yourtable (event, date) VALUES('name', CURDATE() + INTERVAL 15 DAY);

See http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html
for all info on the date and time functions.

--
felix
Please use BBCode to format your messages in this forum.

Options: ReplyQuote


Subject
Written By
Posted
June 10, 2005 07:25AM
Re: how to insert a date to come ?
June 10, 2005 12:02PM


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.