formating mysql timediff output

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 ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-16-2007
crybaby
 
Posts: n/a
Default formating mysql timediff output

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

Reply With Quote
  #2 (permalink)  
Old 10-16-2007
Paul Lautman
 
Posts: n/a
Default Re: formating mysql timediff output

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


Reply With Quote
  #3 (permalink)  
Old 10-17-2007
crybaby
 
Posts: n/a
Default Re: formating mysql timediff output

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 ?

Reply With Quote
  #4 (permalink)  
Old 10-17-2007
Captain Paralytic
 
Posts: n/a
Default Re: formating mysql timediff output

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.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:44 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0