Ruby on rails 比较heroku pgsql上的日期
我正在尝试选择开始日期在本周内的项目Ruby on rails 比较heroku pgsql上的日期,ruby-on-rails,ruby,postgresql,heroku,ruby-on-rails-4,Ruby On Rails,Ruby,Postgresql,Heroku,Ruby On Rails 4,我正在尝试选择开始日期在本周内的项目 Outproject.where('start_at > ? and start_at < ?', Time.now.at_beginning_of_week.to_time,(Time.now.at_beginning_of_week + 5.days).to_time) Outproject.where('start_at>?and start_at=?和start\u at)可能有助于您在heroku配置中添加时区。
Outproject.where('start_at > ? and start_at < ?', Time.now.at_beginning_of_week.to_time,(Time.now.at_beginning_of_week + 5.days).to_time)
Outproject.where('start_at>?and start_at<?',Time.now.at_beging_of u week.to_Time,(Time.now.at_beging_of u week+5.days.)to_Time)
这在本地运行没有问题(运行postgresql),但在heroku上它会给出一个空结果(即使它不应该)
我试过使用.to_time(如上所述),使用.to_date,不使用任何东西,使用DateTime代替time。有什么建议吗?试试这个:
Outproject.where('start_at >= ? and start_at <= ?', DateTime.now.beginning_of_week.utc,(DateTime.now.beginning_of_week + 5.days).utc)
Outproject.where('start\u at>=?和start\u at)可能有助于您在heroku配置中添加时区。