在MySQL当前时间增加2个小时?
问题描述:
在MySQL中此查询的有效语法是什么?
Which is the valid syntax of this query in MySQL?
SELECT * FROM courses WHERE (now() + 2 hours) > start_time
注意:start_time是课程表的字段
答
SELECT *
FROM courses
WHERE DATE_ADD(NOW(), INTERVAL 2 HOUR) > start_time
请参见日期和时间函数用于其他日期/时间操作.
See Date and Time Functions for other date/time manipulation.