MySQL, Rails ActiveRecord date grouping and timezones
问题 I want to count users by creation date. When I query my last user, I have: > User.last.created_at => Thu, 07 Aug 2014 21:37:55 BRT -03:00 When I count users per date I get this: > User.group("date(created_at)").count => {Fri, 08 Aug 2014=>1} The creation date is Aug 7, but the result is Aug 8. This is happening because the group condition is in UTC and my timezone is 'Brasilia'. I have this in my application.rb : config.time_zone = 'Brasilia' config.active_record.default_timezone = :local How