This is a discussion on formating mysql timediff output within the MySQL Database forums, part of the Database Forums category; Is there a way to format output of timediff in following format: day hours minutes seconds? eg: timediff(Oct 16 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
On Oct 16, 5:21 pm, "Paul Lautman" <paul.laut...@btinternet.com>
wrote: > crybaby wrote: > > Is there a way to format output of timediff in following format: day > > hours minutes seconds? > > > eg: > > timediff(Oct 16 2007 130000 - Oct 15 110000) = 1 days 2 hours 00 > > minutes 00 secs > > Yes How do you do this in mysql so that format is in ddhhmmss, someFormatFunction(timediff(Oct 16 2007 130000 - Oct 15 110000)) = 1 days 2 hours 00 minutes 00 secs ? |
|
|||
|
On 17 Oct, 01:50, crybaby <joemystery...@gmail.com> wrote:
> On Oct 16, 5:21 pm, "Paul Lautman" <paul.laut...@btinternet.com> > wrote: > > > crybaby wrote: > > > Is there a way to format output of timediff in following format: day > > > hours minutes seconds? > > > > eg: > > > timediff(Oct 16 2007 130000 - Oct 15 110000) = 1 days 2 hours 00 > > > minutes 00 secs > > > Yes > > How do you do this in mysql so that format is in ddhhmmss, > someFormatFunction(timediff(Oct 16 2007 130000 - Oct 15 110000)) = 1 > days 2 hours 00 minutes 00 secs ? Well according to the manual, the output format of timediff appears to be hours:minutes:seconds.fractionsofseconds You can use a selection of LEFT(), SUBSTR, DIV, % (modulus), REPLACE(), CONCAT; to reformat it to your hearts content. |