Inderjit Gill wrote:
> When the date function is given a date between 999BC and 1BC ...

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

> it formats the year with only 3 digits rather than 4:
>
>     select date(1702797.5);
>     > -050-01-01

The code does the equivalent of sprintf(..., "%04d", year).

> Shouldn't the returned value actually be '-0050-01-01' (As mentioned in
> the ISO 8601 standard's wiki page:
> https://en.wikipedia.org/wiki/ISO_8601#Years)?

That page says:
| An expanded year representation [±YYYYY] must have an agreed-upon
| number of extra year digits beyond the four-digit minimum, and it must
| be prefixed with a + or − sign

So the strict ISO expanded year representation would require a plus sign
or more digits to be used in all cases, which would not be backwards
compatible.

(But printing the sign plus four digits only for negative dates would
indeed be useful, and still be covered by "undefined".)


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to