mysql - adding one year quickly

I don't want to forget how to add one year (or any interval) so I'm making a note.

DATE_ADD functions in MySQL always seem to get me since Sybase seems so different (but probably isn't that much). Plus, I was being very smart and keep trying to put a + instead of a ,. Silly Rabbit!

Here it is: SELECT DATE_ADD(NOW(),INTERVAL 1 YEAR)

An update to set expiration date 1 year into the future:

UPDATE mytable SET exp_timestamp = DATE_ADD(NOW(), INTERVAL 1 YEAR)

Comments

Popular posts from this blog

Changing Dancer::Plugin::Ajax's content type

BootstrapX clickover

2 ways to get SQLite to put dates into columns