Question

In order to get the beginning of today in the current time zone, I had the following code:

Time.zone.today.to_time_in_current_zone

However, upgrading to Rails 4.1 caused an error as the to_time_in_current_zone method was removed. What should I use as an alternative? Time.zone.today.to_time gives me the beginning of the day in UTC time zone.

Was it helpful?

Solution

You should use in_time_zone instead.

Time.zone.today.in_time_zone

Till 4.0.2 to_time_in_current_zone was supported. See this link for more info.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top