• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 301
  • Last Modified:

data conversion

How do I convert 1000 seconds into hh:mi:ss in Oracle?

What I meant is 1000 seconds into hour, minutes, seconds.
0
lium1
Asked:
lium1
  • 2
  • 2
1 Solution
 
slightwv (䄆 Netminder) Commented:
http://www.adp-gmbh.ch/ora/sql/examples/convert_secs_hh_mi_ss.html

select to_char(to_date(1000,'sssss'),'hh24:mi:ss') from dual;
0
 
sdstuberCommented:
easy way is to convert that into a date value then use oracle's built in functions to extract the time string in the format you want...


to_char(trunc(sysdate)+ 1000/86400,'hh24:mi:ss')
0
 
lium1Author Commented:
Sorry, may be I didn't clarify good. What I like to have is convert 10000000 seconds into hours, minutes, and seconds (not come out as days, hours, minutes, and seconds).
0
 
sdstuberCommented:
SELECT      EXTRACT(DAY FROM NUMTODSINTERVAL(10000000, 'SECOND')) * 24
          + EXTRACT(HOUR FROM NUMTODSINTERVAL(10000000, 'SECOND'))
       || ':'
       || EXTRACT(MINUTE FROM NUMTODSINTERVAL(10000000, 'SECOND'))
       || ':'
       || EXTRACT(SECOND FROM NUMTODSINTERVAL(10000000, 'SECOND'))
  FROM DUAL
0
 
lium1Author Commented:
Thanks, sdstuber. It's work perfectly.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now