On Feb 22, 11:08 am, Iain Barnett <[email protected]> wrote:
> On 22 February 2012 18:13, Jeremy Evans <[email protected]> wrote:
>
> > On Feb 22, 8:34 am, Iain Barnett <[email protected]> wrote:
> > > Before the database is initialised:
>
> > >     Sequel.default_timezone = :utc
>
> > This may be the problem.  If the database is storing times in
> > localtime, then you shouldn't set default_timezone = :utc.  You
> > probably want database_timezone = :local and application_timezone
> > = :utc.  This will convert the times from UTC->Local before they go
> > into the database, and Local->UTC upon retrieval from the database.
>
> I tried this and it didn't work, unfortunately. I only added those settings
> after noticing the problem, maybe it wouldn't be an issue if they'd been
> there from the off.

That is likely.  Since you initially had set database_timezone = :utc,
the times that were in the database before you switched to
database_timezone = :local were in UTC and not local time, and would
need to be adjusted manually.

For people having such an issue in the future, make sure you adjust
the current data whenever changing the database_timezone setting.  If
you just change the database_timezone setting without changing
existing data, you will end up with a situation where you will have
times from both timezones in the database, and it will be much more
difficult to make the adjustment later.

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to