Re: Formatting seconds in MM:SS

From: <fitzjarrell_at_cox.net>
Date: Fri, 29 Feb 2008 07:43:08 -0800 (PST)
Message-ID: <a6d633e1-e8a6-4779-89a2-b8c7f568bc83@n58g2000hsf.googlegroups.com>


On Feb 29, 8:32 am, Jens Riedel <Jens..._at_gmx.de> wrote:
> Hi,
>
> I need to display a number of seconds in the <minutes>:<seconds>
> notation, e.g. 100 seconds shall return '01:40'.
> Hours shall NOT be displayed, so for example 7201 seconds shall return
> '120:01', not '02:00:01'...
>
> Has anyone a hint how I can achieve this?
>
> Thanx and best regards,
> Jens

As an example:

select trunc(to_number(to_char(sysdate, 'SSSSS'))/60) ||':'||

          round((to_number(to_char(sysdate, 'SSSSS'))/60 -
          trunc(to_number(to_char(sysdate, 'SSSSS'))/60))*60, 0)
from dual;

Produces the following output:

580:25

where the first number is minutes and the last number is seconds. The example uses sysdate; you can alter that to use whatever time value you've been supplied.

David Fitzjarrell Received on Fri Feb 29 2008 - 09:43:08 CST

Original text of this message