I am in the Asia/Taipei timezone(utc+8).
Rails database time are stored in UTC format, so when I wanna query records that created_at time at 5:xx.
Model.where('EXTRACT(HOUR FROM created_at) = ?', 5)
It always got 13:xx records(5+8), how to fix query with timezone?
固定时区查询
Model.where("EXTRACT(HOUR FROM CONVERT_TZ(created_at,'+00:00','+08:00')) = ?", 5)
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.