Reputation: 1492
I trying to update a all the time present in my database to which is UTC to EST format basically -05:00
First Query I running the following query
update time_info set time = SELECT CONVERT_TZ(time,'+00:00','-05:00');
Now this doesnot seem to work
Now There is other way I can achieve this is something like
update time_info set time = time - 5*3600;
But I was thinking just for sake of learning is it possible to run the first query as expected
Upvotes: 0
Views: 2286
Reputation: 111349
For a DATETIME
column, you can use the CONVERT_TZ
function to convert time zones. Just don't use the SELECT
keyword:
update time_info set `time` = convert_tz(`time`, '+00:00','-05:00');
Upvotes: 1