Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为了在当前时区获得今天的开始,我有以下代码:
Time.zone.today.to_time_in_current_zone
但是,升级到 Rails 4.1 会导致错误,因为该to_time_in_current_zone方法已被删除。我应该使用什么作为替代方案?Time.zone.today.to_time在 UTC 时区给我一天的开始。
to_time_in_current_zone
Time.zone.today.to_time
你应该in_time_zone改用。
in_time_zone
Time.zone.today.in_time_zone
直到 4.0.2to_time_in_current_zone才得到支持。有关更多信息,请参阅此链接。