i use the function like this
SELECT TIME_FORMAT("01:02:03", "%H-%i-%s")
and get the result 01-02-03
while I do not want leading zeros to be 1-2-3
i use php and think of using str_replace()
and trim()
but i do not know if mysql can do it in short
01:02:03 > 1-2-3
00:02:03 > 0-2-3
00:00:03 > 0-0-3
The simplest solution that I can think of is to concatenate separately the hour, minutes and seconds as integers:
SELECT CONCAT_WS('-', HOUR('01:02:03'), MINUTE('01:02:03'), SECOND('01:02:03'))
See the demo.