fluent-plugin-sql icon indicating copy to clipboard operation
fluent-plugin-sql copied to clipboard

ActiveRecord default timezone

Open valeba opened this issue 8 years ago • 4 comments

Hi,

In reading from DB the time is always set to UTC, disregarding the DB setting.

To solve the issue, I tried to this line in the plugin: ActiveRecord::Base.default_timezone = :local

It worked.

Regards

valeba avatar Dec 22 '16 07:12 valeba

Could you send a PR?

repeatedly avatar Jan 11 '17 00:01 repeatedly

Hi, I recently ran into this issue using the out_sql portion of the plugin. I ended up hacked the code to support an extra parameter to override the default timezone. Are you still interested in a PR?

stanleyxc avatar Jun 13 '18 12:06 stanleyxc

@Sjolus 's patch solves my problem, Without it, Time fields were losing time zone information and mis-converted to GMT

gpavinteractiv avatar Aug 30 '21 07:08 gpavinteractiv

Same issue for output plugin as well. Active record automatically fills the columns like "created_at", "updated_at". The time format seems to be UTC with no timezone info, hence UTC time is erroneously logged as local time.

EkremGuner avatar May 31 '22 12:05 EkremGuner