MySQL formatting time with am / pm lowercase

Is there a better way to format a time field to have lowercase letters AM or PM? This is what I have in the SELECT statement, but it works, but it is pretty awkward:

CONCAT_WS('', DATE_FORMAT(time, '%l:%i '), LOWER(DATE_FORMAT(`time`, '%p'))) AS time 

I think more importantly, is there any significant overhead associated with formatting using SQL functions like this?

+6
source share
1 answer

you can do it without calculus.

 LOWER(DATE_FORMAT(`time`,'%l:%i %p')) 

SEE HERE @SQLFiddle

+11
source

Source: https://habr.com/ru/post/920172/


All Articles