Commit 43a80d8a authored by unknown's avatar unknown

Fixed Bug#11324:

TIME_FORMAT using "%l:%i" returns 36:00 with 24:00:00 in TIME column


mysql-test/r/date_formats.result:
  Added test case for Bug#11324,
  "TIME_FORMAT using "%l:%i" returns 36:00 with 24:00:00 in TIME column"
mysql-test/t/date_formats.test:
  Added test case for Bug#11324,
  "TIME_FORMAT using "%l:%i" returns 36:00 with 24:00:00 in TIME column"
parent 4806b1a4
......@@ -491,3 +491,21 @@ TIME_FORMAT("01:00:00", '%r')
SELECT TIME_FORMAT("25:00:00", '%r');
TIME_FORMAT("25:00:00", '%r')
01:00:00 AM
SELECT TIME_FORMAT("00:00:00", '%l %p');
TIME_FORMAT("00:00:00", '%l %p')
12 AM
SELECT TIME_FORMAT("01:00:00", '%l %p');
TIME_FORMAT("01:00:00", '%l %p')
1 AM
SELECT TIME_FORMAT("12:00:00", '%l %p');
TIME_FORMAT("12:00:00", '%l %p')
12 PM
SELECT TIME_FORMAT("23:00:00", '%l %p');
TIME_FORMAT("23:00:00", '%l %p')
11 PM
SELECT TIME_FORMAT("24:00:00", '%l %p');
TIME_FORMAT("24:00:00", '%l %p')
12 AM
SELECT TIME_FORMAT("25:00:00", '%l %p');
TIME_FORMAT("25:00:00", '%l %p')
1 AM
......@@ -287,3 +287,14 @@ SELECT TIME_FORMAT("12:00:00", '%r');
SELECT TIME_FORMAT("15:00:00", '%r');
SELECT TIME_FORMAT("01:00:00", '%r');
SELECT TIME_FORMAT("25:00:00", '%r');
#
# Bug#11324
#
SELECT TIME_FORMAT("00:00:00", '%l %p');
SELECT TIME_FORMAT("01:00:00", '%l %p');
SELECT TIME_FORMAT("12:00:00", '%l %p');
SELECT TIME_FORMAT("23:00:00", '%l %p');
SELECT TIME_FORMAT("24:00:00", '%l %p');
SELECT TIME_FORMAT("25:00:00", '%l %p');
......@@ -609,7 +609,7 @@ bool make_date_time(DATE_TIME_FORMAT *format, TIME *l_time,
break;
case 'l':
days_i= l_time->hour/24;
hours_i= (l_time->hour%24 + 11)%12+1 + 24*days_i;
hours_i= (l_time->hour%24 + 11)%12+1;
length= int10_to_str(hours_i, intbuff, 10) - intbuff;
str->append_with_prefill(intbuff, length, 1, '0');
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment