Tom-

Can you provide some details of your test setup?  What version of SQLite?
What platform (compiler, O/S, processor, 32bit vs 64bit, etc.)?
I updated the date testscripts in CVS to add tests for you cases below, and
they worked correctly for version 3.5.9 of SQLite compiled with both GCC and
MSVC.

Thanks.
-Shane


On 6/11/08, BareFeet <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> Short question:
>
> This:                     select datetime(julianday('2008-06-12',
> 'utc'), 'localtime')
>
> should give this:         2008-06-12 00:00:00
>
> but instead gives this:   2008-06-11 24:00:00
>
> Is this a known bug?
>
>
> More detail:
>
> I am storing dates in julianday (real) format. When I store a date I
> store it as UTC offset and convert it to localtime when displaying it.
>
> So, using an example date, my formula (obviously simplified here)
> boils down to:
>
> select datetime(julianday('2008-06-12', 'utc'), 'localtime')
>
> or when I just want the date component:
>
> select date(julianday('2008-06-12', 'utc'), 'localtime')
>
> But I get unexpected answers:
>
> 2008-06-11 24:00:00   (I expected 2008-06-12 00:00:00)
>
> and:
>
> 2008-06-11            (I expected 2008-06-12)
>
> This seems to me to be a bug, especially because it doesn't make sense
> for the datetime function to return a date plus 24 hours.
>
> It seems to be some rounding error in the date and datetime functions.
> I can manually "fix" it by:
>
> select datetime(julianday('2008-06-12', 'utc'), '0.1 seconds', ,
> 'localtime')
>
> or when I just want the date component:
>
> select date(julianday('2008-06-12', 'utc'), '0.1 seconds', 'localtime')
>
> Thanks,
> Tom
> BareFeet
>
> --
> SQLite GUI tools compared at:
> http://www.tandb.com.au/sqlite/compare/?ml
>
> _______________________________________________
> 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