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
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users