How can I set the default time_zone to the local time zone

Here is the entry in the environment.config to set the time_zone:

# config/environment.rb config.time_zone = ‘UTC’

Instead of setting this to a particular time zone, is it possible to set this to the local time zone?

Thanks, -Rakesh

I don't believe there is a way to set the local time zone in the environment file.

Now, I'm reading a book on Rails that has a section about time zones and it states that you can use a pure-Ruby gem called TZInfo with a TimeZone class that correctly handles DST (Daylight Saving Time). You'll need to install both the tzinfo gem and the tzinfo_timezone plugin, but it's reportedly slow (it could be fast for whatever you're doing)

There's also another solution, but for Mac users. I'm not sure if this still works or not, but I'll give you the code anyways and you can play around with it.

COPY/PASTE