0

为了在当前时区获得今天的开始,我有以下代码:

Time.zone.today.to_time_in_current_zone

但是,升级到 Rails 4.1 会导致错误,因为该to_time_in_current_zone方法已被删除。我应该使用什么作为替代方案?Time.zone.today.to_time在 UTC 时区给我一天的开始。

4

1 回答 1

1

你应该in_time_zone改用。

Time.zone.today.in_time_zone

直到 4.0.2to_time_in_current_zone才得到支持。有关更多信息,请参阅此链接

于 2014-04-09T10:24:13.517 回答