On August 24, 2019 1:12:21 p.m. EDT, Petr Slansky <slan...@usa.net> wrote:
>I discovered julianday() function and because it is linked to the
>distant
>past, I tried to find some old dates and I found a bug in date()
>function for
>date in range -1000-0000 (1000BC-0BC):
>
>sqlite> select date('-1000-01-01'); -- OK
>-1000-01-01
>sqlite> select date('-0999-01-01'); -- BUG, should return date
>'-0999-01-01'
>-999-01-01
>sqlite> select date('-999-01-01'); -- cannot be converted to
>'-0999-01-01'
>
>sqlite> select date('-0001-01-01');  -- BUG, should report date
>'-0001-01-01'
>-001-01-01
>sqlite> select date('-001-01-01');
>
>sqlite> .version
>SQLite 3.22.0 2018-01-22 18:45:57
>0c55d179733b46d8d0ba4d88e01a25e10677046ee3da1d5b1581e86726f2alt1
>zlib version 1.2.11
>gcc-7.4.0
> 
>With regards,
>
>---------------------------------
>  Petr Slansky, slan...@usa.net
>
>
>_______________________________________________
>sqlite-users mailing list
>sqlite-users@mailinglists.sqlite.org
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

The documentation is explicit that behaviour for negative dates is undefined:

> These functions only work for dates between 0000-01-01 00:00:00 and 
> 9999-12-31 23:59:59 (julian day numbers 1721059.5 through 5373484.5). For 
> dates outside that range, the results of these functions are undefined.

<https://sqlite.org/lang_datefunc.html>
-- 
J. King
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to