开发者

Rails 3, updated_at is 1 day ahead?

F开发者_JAVA技巧or some reason when updating a record, updated_at is getting updated as 2011-01-23, even though Date.today is returning 2011-01-22. Why are these different? Is there a way to set them to be the same?

Thanks!


By default, Rails uses UTC as the timezone for all created_at and updated_at fields. You can override this by setting a custom timezone in config/application.rb:

config.time_zone = 'Central Time (US & Canada)'

You can run rake time:zones:all from your application directory to get a list of all valid time zones.


Did you set your time zone in the config/environment.rb file?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜