Converting seconds to elapsed time format

Hi:
I'm trying to do something like...
select to_char(3661,'hh24:mm:ss') from dual;
...to get...
01:01:01
3661 being the number of seconds in 1hour + 1 minute + 1 second. to_char(62,'hh24:mm:ss') would be 00:01:02, etc... .
Any ideas?
Thanks in Advance

Hi,
The previous answer will work how long the number of seconds will be less than 86400(the number of seconds of a day).
So, for a greater number of seconds you have to use an arithmetical transformation:
For example:
Let's say that we have to transform 190 000 into days, hours, minutes and seconds.
select trunc(190000/86400) days,
trunc((mod (190000,86400)/86400)*24) hours,
trunc( ( (mod(190000,86400)/86400)*24 -
trunc((mod(190000,86400)/86400)*24) ) * 60 )
minutes
-- so on ...
from dual;
DAYS HOURS MINUTES
___2 _______4 ______46
So, if you want that format 'dd hh24:mi:ss', you have to use concat operator and, eventually, lpad function
(i.e. lpad(expresion,2,'0') ).
Eugen

Similar Messages

  • (Neno Second) Date and Time Format (URGENT)

    With the name of ALLAH,
    Dear group fellows,
    I have to pickup text data into date field. The data is as under
    1707200214153090
    First Two digits = Day (DD)
    3rd and 4th digits = Month (MM)
    5th,6th,7th and 8th digits = Year (YYYY)
    9th and 10th digits = Hours (HH)
    11th and 12th digits = Minutes (MM)
    13th and 14th digits = Seconds (SS)
    15th and 16th digits = Neno Seconds (NS)
    Now I want to enter the whole string into a field of date datatype. I do not have problem entering upto Seconds, but I do not know how to enter neno seconds into the field. Plz tell me if it is possible to enter neno secons into date datatype field or not? If possible then how? Plz help, its urgent...
    Best Regards
    Faisal Rafique.

    not possible in 8i, but I thought it is possible in 9i.
    greetings
    Freek D
    With the name of ALLAH,
    Dear group fellows,
    I have to pickup text data into date field. The data is as under
    1707200214153090
    First Two digits = Day (DD)
    3rd and 4th digits = Month (MM)
    5th,6th,7th and 8th digits = Year (YYYY)
    9th and 10th digits = Hours (HH)
    11th and 12th digits = Minutes (MM)
    13th and 14th digits = Seconds (SS)
    15th and 16th digits = Neno Seconds (NS)
    Now I want to enter the whole string into a field of date datatype. I do not have problem entering upto Seconds, but I do not know how to enter neno seconds into the field. Plz tell me if it is possible to enter neno secons into date datatype field or not? If possible then how? Plz help, its urgent...
    Best Regards
    Faisal Rafique.

  • Converting seconds to HH:MM:SS

    Apologies if this has been answered already, but I'm simply trying to convert seconds to HH:MM:SS. If someone could point me to how Numbers can best handle that I'd appreciate it.
    Here's an example: The CSV I receive has a duration column that has the number 3718 in it, representing the total number of seconds. What I wish to see is it broken out to read 01:01:58.
    Thanks in advance.

    Hello
    I'm not sure that I understand well your question.
    Numbers is right: B2:B4 is not a number, it's a range of cells.
    Your formula is trying to use this range of cells as a number representing the minutes: it's meaningless. The number of minutes may be given two ways
    B2B3B4
    This way the formula would be =TIME(0,B2B3B4,0)
    an alternate way (more efficient) is
    SUM(B2:B4) (which means sum of the contents of every cell from B2 thru B4
    This way the formula would be =TIME(0,SUM(B2:B4),0)
    If you looked at the Help you would have read:
    TIME
    The TIME function converts hours, minutes, and seconds into a time format.
    TIME(hours, minutes, seconds)
    hours: The number of hours (using a 24-hour clock).
    minutes: The number of minutes.
    seconds: The number of seconds.
    Notes
    You can specify hour, minute, and second values greater than 23, 59, and 59, respectively. If the hours, minutes, and seconds add up to more than 24 hours, Numbers subtracts 24 hours repeatedly until the sum is less than 24 hours.
    If you don't wish to see the seconds appearing in the cell, apply the format Time > hh:mm
    I agree with most users about the need for enhancements about the time treatment, mainly the addition of a "Duration" format not limited to the range 0 thru 23:59:59.
    BUT for the questions asked in this thread no enhancements are required.
    The available tolls fit perfectly the needs … but of course, users must read the given explanations
    I'm always surprised to see guys paying to learn to use a bicycle and many other tools but reluctant to learn how to use softwares they are employing daily.
    I never accepted the well known acronym: RTFM (Read The Fu…g Manual).
    In fact I never read a manual, but I consult them when I need an info.
    I always thought that forums are here to respond to questions whose responce is not in the manuals (and they are sufficiantly numerous).
    Of course, it is often more time consuming to explain this advice than reproducing some lines from the manual but I think that no one may seriously use a tool begging the info for every task.
    We are assumed to be thinking beeings. Aren't we ?
    Of course the given formulas assumes that the time value is fitting the Numbers's requirements (from 0 thru 23:59:59)
    Yvan KOENIG (from FRANCE jeudi 3 janvier 2008 13:38:55)

  • Flash video: display elapsed time

    I am using the FLVPlayback component and one of the video
    templates from this site that uses screens. I want to display
    elapsed time/total time. I can't find a script to do that although
    i do find some if you don't use the FLVPlayback component.
    any help would be much appreciated.

    Hey Pat, I'm using something like this. You need to place the
    time() function on frame 1 and place the bottom code in an event or
    on a frame loop (while the video plays)
    // assumes the FLV Playback component with an instance name -
    VideoPlayer
    // time fiunction converts seconds to actual time
    function time($seconds) {
    if ($seconds !="Z") {
    var $time:Number = $seconds;
    var $min:Number = Math.floor($time/60);
    //var $hrs:Number = Math.floor($min % 60);
    var $sec:Number = $time % 60;
    if ($sec <10 ) {
    var $sec:String = "0"+$sec;
    if ($min < 1 ) {
    var $min:String = "";
    var $timing:String = $min + ":" + $sec;
    } else {
    var $timing:String="";
    return $timing;
    // displays in a textfield- VidTime
    VidTime.text = time(Math.floor(VideoPlayer.playheadTime))+"
    of "+time(Math.floor(VideoPlayer.totalTime));

  • Write elapsed time to a spreadsheet in hours:minutes:seconds format

    Hi everyone,
    I've been trying to write an elapsed time to a spreadsheet file in an hours:minutes:seconds format, but the time is displayed in a floating point value of seconds..
    how can I write to a spreadsheet in an hours:minutes:seconds format.
    Thank you,
    James-

    I often use a subVI that converts Seconds to Hours, Minutes and Seconds. Use the Quotient and Remainder function to divide your elapsed time by 3600, 60 and 1. You can then convert those values to a modified string and use the Write to Spreadsheet File.
    As Dennis said, newer versions of LabVIEW's Write to Spreadsheet File.VI can handle arrays of Double, Integer or String automatically, and in older versions, the Write to Spreadsheet File.VI can be modified and copied to handle strings.
    Hope this helps.
    (Written in 8.5)
    Message Edited by LabViewGuruWannabe on 01-18-2008 09:28 PM
    Attachments:
    TimeToSpreadsheet.vi ‏26 KB
    SecondstoHMS.png ‏32 KB

  • Elapsed time - seconds to string

    Hello everyone,
    I have what seems to be a simple problem that I can't resolve. In the attached example I wish to convert the elapsed time (s) to a timestamp (h:m:s.ms). The problem is that I can't get the timestamp to start a 00:00:00.000 , it starts at 11:00:00.000. What can I do to get the timestamp to start at an absoulte 0s and not have the hour reset after 24hrs. One of my applications runs for 180hrs.
    thanks,
    David
    Attachments:
    Simple Elapsed Time.vi ‏29 KB

    I hope I understood you correctly.
    You want to have the net time of your program displayed in HH:MMS format but your problem is that the string starts at 11:00 am and that after 23:59 it goes to 00:00. In that case, my suggestion should help. The number will be displayed correctly.
    And now, a magic trick...
    You live in.......... Australia!
    Or somewhere near that time zone. The reason you're seeing 11:00 when you input 0 into the format function is that the internal LV timer starts from 00:00 GMT 01/01/1904. The 11:00 you're seeing is actually in 1904, and that's also the reason the time is reset after 23:59.
    You can also use the Get date/time in seconds VI Instead of the ms counter. You won't need to divide by a 1000.
    Try to take over the world!

  • Convert seconds to [h]:mm:ss format on report text box

    I want to convert seconds to hh:mm:ss format on the report text box.
    I use =Format(Sum([MyTime])/(24*60*60),"hh:nn:ss"), but it does not work if the hours more than 24 hours, since the format is for  the time format for the day.
    I need the result shows more than 24 hours, because I want to show how many hours and minutes from my seconds value.
    I can use [h]:mm:ss for Excel that it gives me the total hours more than 24 hours.
    I tried to use the following to my text box
    Int((sum(MyTime)) / 3600) & Format(Int((sum(MyTime) / 60) Mod 60, "\:00") & Format(sum(MyTime) Mod 60, "\:00"),
    but for some reason it only shows seconds part without minute and hour part of the value.
    Your help and information is great appreciated,
    Regards,
    Souris,

    I want to convert seconds to hh:mm:ss format on the report text box.
    I use =Format(Sum([MyTime])/(24*60*60),"hh:nn:ss"), but it does not work if the hours more than 24 hours, since the format is for  the time format for the day.
    I need the result shows more than 24 hours, because I want to show how many hours and minutes from my seconds value.
    Hi sourises,
    You can use the next function. Place it in a general module.
    Function Sec_to_str(seconds)
    Dim uur As Integer
    Dim min As Integer
    Dim sec As Integer
    Dim cur_sec As Variant
    cur_sec = seconds
    If (IsNull(cur_sec)) Then
    Sec_to_str = Null
    Else
    sec = cur_sec Mod 60
    cur_sec = cur_sec \ 60
    min = cur_sec Mod 60
    cur_sec = cur_sec \ 60
    uur = cur_sec
    If (uur = 0) Then
    Sec_to_str = Format(min, "#0") & ":" & Format(sec, "00")
    Else
    Sec_to_str = Format(uur, "#0") & ":" & Format(min, "00") & ":" & Format(sec, "00")
    End If
    End If
    End Function
    Imb.

  • Get Time Stamp will milli seconds from string time stamp format

    Hi Guys,
    I am trying to get the time stamp with milli seconds value from string format time data,
    Attached the snippet (Get milli seconds to Time stamp)I  tried.
    Attached Sub VI Convert string to time stamp
    When run,I am not getting the time string indicator with milli seconds value even though the format have <%2u> .
    please guide me on this.
     ..AND Finally i will be converting the date and time string output to time stamp data type
    Attachments:
    Convert_String_to_TimeStamp.vi ‏13 KB
    Get Milli seconds to Time stamp.png ‏25 KB

    You do realize you could have just used a single Scan From String to get the timestamp, right?
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Get Timestamp.png ‏43 KB

  • Converting seconds to hh:mm:ss format?

    Hi, can anyone help me with a formula in Webi XIR2 to convert seconds to hh:mm:ss in the result cell on the report level? Now we have results in the cells in seconds and should have this format: 00:04:12  for 0h 4min et 12 s.
    Thanks in advance.
    Laurent Peter

    Hi,
    If you want to do this at the report level then try the following.
    Create a new Variable and define it as:
    =FormatNumber(Floor(<Column_Name>/3600) ,"00") & ":" & FormatNumber(Floor(Mod(<Column_Name> ,3600)/60) ,"00") & ":" & FormatNumber(Mod(Mod(<Column_Name> ,3600) ,60) ,"00")
    In the above formula Column_Name is the attribute that displays the seconds.
    - Noman Jaffery

  • Convert Epoch Date Time to Date Time format

    I am trying to convert Epoch Date time in GMT to Human Readable Date time format in UTC. I used the one below but it returns just the date in GMT but how can get datetime in UTC ?
    select To_Char( To_Date( '01.01.1970 06:00:00','DD.MM.YYYY HH24:Mi:Ss') + STARTIME / 86400,'DD.MM.YYYY HH24:Mi:ss') FROM HQ_AVAIL_DATA_RLE;
    I refered a couple of forums and applied everything, but still I wouldn't get the timestamp.
    Please note that i'm looking for datetime stamp, not just the date.
    Thanks in advance!
    Edited by: 830754 on Jan 27, 2011 11:18 AM
    Edited by: 830754 on Jan 27, 2011 11:19 AM

    Works for me. I see date and time (submitted 1000 for STARTTIME):
    select To_Char( To_Date( '01.01.1970 06:00:00','DD.MM.YYYY HH24:Mi:Ss') + 1000 / 86400,'DD.MM.YYYY HH24:Mi:ss')
    from dual
    TO_CHAR(TO_DATE('01
    01.01.1970 06:16:40Or do you mean something else?

  • How to convert 12 hour time format to 24 hour time format ?

    Hi,
    How to convert 12 hour time format to 24 hour time format is there any FM if not, please suggest me how to convert .
    regards,
    rakesh

    Hi,
    Have you tried function module HRVE_CONVERT_TIME
    Input parameters will be like
    TYPE_TIME                       B
    INPUT_TIME                      01:00:00
    INPUT_AM_PM                  PM
    Output
    OUTPUT_TIME                     13:00:00
    Regards

  • Converting seconds to minutes format

    Post Author: mwatson
    CA Forum: WebIntelligence Reporting
    How do you convert seconds to minutes in mm:ss format?

    Post Author: SKodidine
    CA Forum: WebIntelligence Reporting
    totext(truncate(/60),0,'','') & ":" & totext(remainder(,60),0,'','')

  • Time format that provides seconds

    I'm using the time format of 0;00;00;00.  However, this doesn't count off seconds anywhere.  I'd like to sync video with an audio track.  I'm using seconds to recognize exact places to sync.  Is there a time format in AE that will read out seconds?

    That is seconds.
    The format is
    Hours;minutes;seconds;frames
    When you see a ; instead of a : the time is accurate in NTSC land. If the digits are separated by a : it means you're in non-drop frame timecode display. Non drop means that the real time of the display is not accurate but that the frames always count up to 30. In drop frame (real time) time code, frames are counted at 29.97 frames per second so every so many seconds one of the numbers is dropped. No frames are dropped, it's jut that count doesn't smoothly go 28, 29, 00, 01 02 every time.  This is done so that the real time of the display corresponds to the clock in seconds.
    You'll find more info in the help files. Click this link to go there.

  • Converting zulu format to date and time format

    I want to convert zulu format to regular dateand time format. so for e.g I have this date and time in my table
    021731ZJUN06, I want to convert it to 2006-06-02 17:31:00
    I wrote this in sql server, but don't know how to do this in oracle
    ALTER function [dbo].[ZULUToDateTime](@initDate varchar(20))
    RETURNS datetime
    AS
    BEGIN
    DECLARE @NewDate datetime
    SET @NewDate = NULL
    IF @initDate <> 'false'
    BEGIN
         SET @NewDate=     CONVERT(datetime,LEFT(@initDate,2)+ ' ' + STUFF(right(@initDate,5),4,0,' ') + ' ' +STUFF(SUBSTRING(@initDate,3,4),3,0,':'),121)  
    END
    RETURN @NewDate
    END

    Like this?
    SQL> select to_date('021731ZJUN06', 'ddhh24mi"z"monrr')
      2  from dual;
    TO_DATE('021731ZJUN0
    02-jun-2006 17:31:00Gotta love Oracle's date formatting fuctions :-)
    The format above is my default session format, if you explicitly want the format you showed, you need an extra to_char like:
    SQL> select TO_CHAR(to_date('021731ZJUN06', 'ddhh24mi"z"monrr'), 'yyyy-mm-dd hh24:mi:ss')
      2  from dual;
    TO_CHAR(TO_DATE('021
    2006-06-02 17:31:00John
    Edited by: John Spencer on Nov 10, 2011 1:45 PM
    Added correct output format.

  • GregorianCalendar datetime format convert to  sql server date time format

    please help me
    my GregorianCalendar date time format is like this. *08/01/29 02:25:59* . I try to insert my database(sql server 2000 )
    data type is datetime ,in my database table display like this *2029-08-01 02:25:59.000* .can you help me to insert correct date in my database table like ( . *08/01/29 02:25:59*)

    use [PreparedStatement |http://java.sun.com/javase/6/docs/api/java/sql/PreparedStatement.html] and setTimestamp:
    [http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html]

Maybe you are looking for