ActiveRecord time zone without rails

I am using ActiveRecord in a project without rails. In rails I can do:

config.time_zone = 'Eastern Time (US & Canada)' config.active_record.default_timezone = 'Eastern Time (US & Canada)' 

But if I do not use rails, how to set the time zone?

+4
source share
2 answers
 ActiveRecord::Base.default_timezone = 'Eastern Time (US & Canada)' 
+2
source
 ActiveRecord::Base.default_timezone = :local 

also works for me.

+2
source

Source: https://habr.com/ru/post/1491380/


All Articles