当我在我的rails控制台中运行以下命令时,我得到当前的当地时间。
> Time.current.getlocal
=> 2018-03-20 17:48:38 +0530
但是当我在查询中使用它时,结果会有所不同,请查看以下查询
warehouse = Warehouse.joins(:timings).where("timings.day = ? and timings.open_at < ? and timings.close_at > ?", Date.current.strftime("%A"), Time.current.getlocal, Time.current.getlocal).group("warehouses.id")
Warehouse Load (1.0ms) SELECT "warehouses".* FROM "warehouses" INNER JOIN "timings" ON "timings"."warehouse_id" = "warehouses"."id" WHERE (timings.day = 'Tuesday' and timings.open_at < '2018-03-20 12:18:44.783130' and timings.close_at > '2018-03-20 12:18:44.783166') GROUP BY warehouses.id LIMIT $1 [["LIMIT", 11]]
我想知道为什么postgres查询不占用当地时间?