简体   繁体   中英

Mysql query not working with IST timezone

I have table "bookings" in mysql and i want to fetch those record whose "bookingtime"(data type is "Datetime") more than 40 minutes ( according to IST) My query not working with IST,

Here is my table "booking"

id      name        bookingtime
1       ayhd        2020-01-09 15:23:33
2       dhdye       2020-01-09 14:53:38
3       juey        2020-01-09 11:13:53

I tried with following query but not showing any result,Where i am wrong ?

SELECT * FROM booking
WHERE bookingtime < (NOW() - INTERVAL 40 MINUTE)

试试这个查询,它会得到现在到 40 分钟前的记录

SELECT * FROM `booking` WHERE `bookingtime` >= (NOW() - INTERVAL 40 MINUTE) AND `bookingtime` < NOW()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM