diff options
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r-- | sql/item_timefunc.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index f3d6858755c..670fb94fc2c 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -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; @@ -620,7 +620,8 @@ bool make_date_time(DATE_TIME_FORMAT *format, TIME *l_time, case 'r': length= my_sprintf(intbuff, (intbuff, - (l_time->hour < 12) ? "%02d:%02d:%02d AM" : "%02d:%02d:%02d PM", + ((l_time->hour % 24) < 12) ? + "%02d:%02d:%02d AM" : "%02d:%02d:%02d PM", (l_time->hour+11)%12+1, l_time->minute, l_time->second)); |