Bug #67622 Date-0 and DATE_FORMAT

Submitted: 17 Nov 2012 14:11 Modified: 14 Dec 2025 18:28
Reporter: halászsándor halászsándor Email Updates:
Status: Not a Bug 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.
[14 Dec 2025 18:28] Roy Lyseng
Posted by developer:
 
I think Bernt is correct.
Not a bug.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.