Hi I have a table that have timestamp column. I want to update a date with 1 second before of it. How can I do that?
Exp:
name | date
ibrahim |
2011-04-14 03:35:05
blabla |
2011-04-14 03:00:00
.
.
.
After update, date of second row should be “2011-04-14 02:59:59” etc.
edit:
answer is
UPDATE table SET
date=DATE_SUB(date,INTERVAL 1 SECOND)
WHERE name=”blabla”;
Use DATE_SUB(date,INTERVAL expr unit) function.
or