How to subtract hours from a datetime in MySQL?

后端 未结 2 758
眼角桃花
眼角桃花 2020-11-27 05:40

I get a datetime field, that\'s currently in the query as:

SELECT DATE_FORMAT(x.date_entered, \'%Y-%m-%d\') AS date FROM x ORDER BY date ASC
<
2条回答
  •  旧巷少年郎
    2020-11-27 05:53

    mySQL has DATE_SUB():

    SELECT DATE_SUB(column, INTERVAL 3 HOUR)....
    

    but would it not be better to try and sort out the underlying time zone issue instead?

提交回复
热议问题