为mysql当前时间戳添加12小时

时间:2011-11-09 19:54:11

标签: mysql date

我正在尝试过滤我的查询数据,只返回"Meeting Start"大于CURRENT_TIMESTAMP 的项目不迟于12小时CURRENT_TIMESTAMP。

我可以在查询中下面的CURRENT_TIMESTAMP中添加12小时吗?

当前工作查询:

$query ="SELECT * FROM Reservations WHERE [Room_ID] = '$field' AND [Meeting Start] > CURRENT_TIMESTAMP ORDER BY [Meeting Start] asc ";

更新了尝试:

$query ="SELECT * FROM Reservations WHERE [Room_ID] = '$field' AND [Meeting Start] > CURRENT_TIMESTAMP AND [Meeting Start] < (CURRENT_TIMESTAMP + 12) ORDER BY [Meeting Start] asc ";

1 个答案:

答案 0 :(得分:35)

NOW() + INTERVAL 12 HOUR应该做到这一点。 +12含糊不清。 12秒?分钟?天?年?