MySQL add 12 hours to a time field

后端 未结 5 1174
渐次进展
渐次进展 2020-12-03 21:18

I need to add 12 hours to a MySQL TIME field (not DATETIME) and I\'m having trouble.

UPDATE `events` 
SET start_time = DATE_ADD(sta         


        
5条回答
  •  没有蜡笔的小新
    2020-12-03 21:49

    UPDATE `events` 
    SET start_time = start_time + INTERVAL 12 HOUR
    WHERE `start_time` < '11:00:00'
    

    The MySQL functions that accept INTERVAL arguments are mostly unnecessary; you can just add and subtract intervals with + and -.

提交回复
热议问题