I'm using the value of one date table, minus the other date table to create a total time date table. However, I don't like the format.
CONCAT(
TIMESTAMPDIFF(day,TIME_END,TIME_START), 'd',
MOD(TIMESTAMPDIFF(hour,TIME_END,TIME_START), 24), 'h',
MOD(TIMESTAMPDIFF(minute,TIME_END,TIME_START), 60), 'm'
) AS Total_Times
Results appear like this:
- 0d0h-48m
- -2d-1h-7m
- 0d0h-33m
- 0d0h0m
- -1d-21h-47m
It seems that if the number is higher than zero, it'll add a hyphen next to it, otherwise it'll group whatever is next to it without a space. How can I get it to create a space between zero's and and remove hyphens to appear like this:
- 0d 0h 48m
- 2d 1h 7m
- 0d 0h 33m
- 0d 0h 0m
- 1d 21h 47m
Note, in the actual date columns (TIME_END,TIME_START) their values are written like 2020-11-02 15:32:28.