Timmy O'tool
Timmy O'tool

Reputation: 23

How to do this simple math in a mysql query?

I have a db column called timestamp which is exactly what it holds. I want to get the sum of the timestamp and 10 days. How will that query look?

In other words how can I say this in:

SHOW ME THE RESULT OF TIMESTAMP + 10 DAYS;

in working sql syntax of course :)

Upvotes: 1

Views: 340

Answers (3)

Andrew Cooper
Andrew Cooper

Reputation: 32576

Try this:

SELECT ADDDATE(timestamp, 10) from tablename;

Upvotes: 0

Xint0
Xint0

Reputation: 5389

Try this:

SELECT DATE_ADD(`timestamp`, INTERVAL 10 DAY) FROM `table`;

Upvotes: 0

Finbar Crago
Finbar Crago

Reputation: 444

I think what you want is something like:

SELECT DATE_ADD(NOW(),INTERVAL 10 day);

http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-add

Upvotes: 1

Related Questions