That would make sense.  Thank you for clearing that up.

On Tue, Dec 20, 2011 at 8:50 AM, Igor Tandetnik <itandet...@mvps.org> wrote:

> Stephen Chrzanowski <pontia...@gmail.com> wrote:
> > I live in GMT-5 (America/Toronto).  Current time is 8:06am, which should
> be
> > 13:06Z.  However, according to this:
> >
> > select datetime('now','localtime'),datetime('now','utc');
> > datetime('now','localtime')    datetime('now','utc')
> > 2011-12-20 08:05:24            2011-12-20 18:05:24
>
> You misunderstand how modifiers work. datetime('now'), with no modifier,
> produces a string reflecting UTC time. 'localtime' modifier assumes that
> the string to the left of it represents time in UTC, and converts it to
> local time - so far so good. 'utc' does the reverse - it assumes that the
> string to the left is in local time, and converts it to UTC. But since
> 'now' is already in UTC, you effectively apply the time zone bias twice -
> that's how you end up with 10 hours difference.
>
> > One thing I JUST tried now is the following:
> >
> > select datetime('now','localtime'),datetime('now','localtime','utc');
> > datetime('now','localtime')    datetime('now','localtime','utc')
> > 2011-12-20 08:10:43            2011-12-20 13:10:43
>
> Naturally, since 'localtime' and 'utc' do the exact opposite adjustments,
> datetime('now','localtime','utc') is equivalent to datetime('now'). It's
> like being surprised that -(-1) == 1
> --
> Igor Tandetnik
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to