Is this a bug in date_format function?

Hello,

I’ve just tried the following format string for a few datetime values:

cr> SELECT date_format('%W the %D of %M %Y %H:%i %p', '2021-10-11') as formatted_date_string;
+--------------------------------------------+
| formatted_date_string                      |
+--------------------------------------------+
| Monday the 11thst of October 2021 00:00 AM |
+--------------------------------------------+
SELECT 1 row in set (0.001 sec)
cr> SELECT date_format('%W the %D of %M %Y %H:%i %p', '2021-10-12') as formatted_date_string;
+---------------------------------------------+
| formatted_date_string                       |
+---------------------------------------------+
| Tuesday the 12thnd of October 2021 00:00 AM |
+---------------------------------------------+

To me expressions such as “11thst of October” and “12thnd of October” seem wrong.

Is this a bug in CrateDB’s date_format function?

1 Like

This indeed seems to be a bug. I created a bug issue: `date_format()` bug for formatting `%D` · Issue #11828 · crate/crate · GitHub

2 Likes

Should be fixed with the next hot-fix release.

Thanks for reporting!

3 Likes