dbTalk Databases Forums  

Formatting seconds in MM:SS

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Formatting seconds in MM:SS in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Maxim Demenko
 
Posts: n/a

Default Re: Formatting seconds in MM:SS - 03-04-2008 , 12:35 AM






Jens Riedel schrieb:
Quote:
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
You already got some ideas how to solve your problem, just in case, your
input is not time but simply a number of seconds, you can do something
like this

SQL> with t as (
2 select 100 s from dual union all
3 select 7201 from dual)
4 select s,trunc(s/60)||':'||mod(s,60) "M:S" from t;

S M:S
----------
---------------------------------------------------------------------------------
100 1:40
7201 120:1

Best regards

Maxim


Reply With Quote
  #12  
Old   
Maxim Demenko
 
Posts: n/a

Default Re: Formatting seconds in MM:SS - 03-04-2008 , 12:35 AM






Jens Riedel schrieb:
Quote:
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
You already got some ideas how to solve your problem, just in case, your
input is not time but simply a number of seconds, you can do something
like this

SQL> with t as (
2 select 100 s from dual union all
3 select 7201 from dual)
4 select s,trunc(s/60)||':'||mod(s,60) "M:S" from t;

S M:S
----------
---------------------------------------------------------------------------------
100 1:40
7201 120:1

Best regards

Maxim


Reply With Quote
  #13  
Old   
Maxim Demenko
 
Posts: n/a

Default Re: Formatting seconds in MM:SS - 03-04-2008 , 12:35 AM



Jens Riedel schrieb:
Quote:
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
You already got some ideas how to solve your problem, just in case, your
input is not time but simply a number of seconds, you can do something
like this

SQL> with t as (
2 select 100 s from dual union all
3 select 7201 from dual)
4 select s,trunc(s/60)||':'||mod(s,60) "M:S" from t;

S M:S
----------
---------------------------------------------------------------------------------
100 1:40
7201 120:1

Best regards

Maxim


Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.