I have a table containing a datetime column.
I need to add 15 hours to all these values.
e.g.
As Is: 2007-08-22 08:55:10
To Be: 2007-08-22 23:55:10
As Is: 2009-08-22 14:55:10
To Be: 2009-08-23 05:55:10
Is there a MySQL UPDATE
query that can do this?
Given that test
is the table, date_col
is the column with the date to be updated and id
is the primary key of the test
table:
update test set date_col = ADDTIME(date_col, '15:0:0') where id=1;
tested with mysql version 5.5.4
update table_name set column_name =DATE_ADD(column_name, INTERVAL 15 HOUR)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With