Bug #67622 Date-0 and DATE_FORMAT
Submitted: 17 Nov 2012 14:11 Modified: 28 Dec 2012 18:16
Reporter: halászsándor halászsándor Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Data Types Severity:S3 (Non-critical)
Version:5.0.97, 5.1.68, 5.5.30, 5.7.1 OS:Any
Assigned to: CPU Architecture:Any

[17 Nov 2012 14:11] halászsándor halászsándor
Description:
When a date has 0 in the middle (calendar-month), the value of DATE_FORMAT with format %b or %M is NULL. That seems too harsh.

How to repeat:
set @d = date(10000);
select date_format(@d, '%y/%m/%d');
select date_format(@d, '%y/%M/%d');

Suggested fix:
It would be better if for format %b or %M it showed, say, 0, or maybe 'W' since that letter is not found in any calendar-month name derived from Latin in quite a few European tongues (found in Welsh and Maltese)--but at least not make the whole value NULL.
[28 Dec 2012 18:16] Sveta Smirnova
Thank you for the report.

Verified as described.

I'd call this is a bug, because behavior of %m and %M is inconsistent. Also I'd say %m should return NULL too.