Bug #11324 TIME_FORMAT using "%l:%i" returns 36:00 with 24:00:00 in TIME column
Submitted: 14 Jun 2005 16:02 Modified: 12 May 2006 14:04
Reporter: chris cohen Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version: 4.1.12 OS:Linux (Linux (Redhat Fedora))
Assigned to: Jani Tolonen CPU Architecture:Any

[14 Jun 2005 16:02] chris cohen
Description:
Time columns in mysql with "24:00:00" in them return 36:00 AM  when using the TIME_FORMAT function in the following way:

select TIME_FORMAT("24:00:00", '%l:%i %p');

So, it appears that the %l argument returns a nonsensical hour of the day.

How to repeat:
select TIME_FORMAT("24:00:00", '%l:%i %p');

Suggested fix:
this worked in previous versions.  it correctly interpreted 24:00:00 as "12:00 AM", which was the same as "00:00:00".
[18 Jun 2005 6:30] Vasily Kishkin
Tested on Windows 2000 Prof SP 4, Mysql 4.1.13

mysql> select TIME_FORMAT("24:00:00", '%l:%i %p');
+-------------------------------------+
| TIME_FORMAT("24:00:00", '%h:%m %p') |
+-------------------------------------+
| 36:00 AM                            |
+-------------------------------------+
1 row in set (0.00 sec)

mysql> select TIME_FORMAT("23:59:59", '%l:%i %p');
+-------------------------------------+
| TIME_FORMAT("23:59:59", '%l:%i %p') |
+-------------------------------------+
| 11:59 PM                            |
+-------------------------------------+
1 row in set (0.00 sec)
[4 May 2006 16:50] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/5963
[9 May 2006 9:07] Magnus BlÄudd
Ok to push.
[12 May 2006 14:04] Jani Tolonen
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html