Converting seconds to Days,Hours,mins and secs

Hi gurus,
I have a metric in seconds , which is a box uptime . I want to convert that into Days,hours , mins and secs .How can I do that ?
For example , If I have 433500 secs , I should show it as 5days 00:25:00 or in some meaningful format . Can anyone help me out ?
Thanks,

Hi,
Refer thinks,
Re: seconds to hh:mm:ss format
OBIEE 11g - Change seconds to DD HH:MM:SS format
Deva

Similar Messages

  • Convert seconds to Days, hours, Minutes, Seconds in Reporting Services

    Hi Guys,
    Im currently reporting of an analysis services cube, however I have value which is in seconds and would like to report on this in reporting services as day:HH:MM:SS.
    Has anyone got any experience reporting in this format?
    Regards
    Dave

    Hi Dave,
    We can use custom code to convert seconds to HH:MM:SS
    Public Function Calculate(ByVal TotalSeconds as Integer) as String
    Dim Hours, Minutes, Seconds As Integer
    Dim Hour, Minute, Second As String
    Hours = floor(TotalSeconds/ 3600)
    IF Hours<10
       Hour="0" & Hours.ToString
    Else
       Hour=Hours.ToString
    End IF
    Seconds = TotalSeconds Mod 3600
    Minutes =floor( Seconds / 60)
    IF Minutes<10
       Minute="0" & Minutes.ToString
    Else
       Minute=Minutes.ToString
    End IF
    Seconds = Seconds Mod 60
    IF Seconds<10
       Second="0" & Seconds.ToString
    Else
       Second=Seconds.ToString
    End IF
    Return Hour & ":" & Minute & ":" & Second
    End Function
    Then we can use the expression to conver it.
    =Code.Calculate(Fields!Column.Value)
    The report looks like below:
    If you have any questions, please feel free to ask.
    Regards,
    Charlie Liao
    If you have any feedback on our support, please click
    here.
    Charlie Liao
    TechNet Community Support

  • Convert seconds value to hours & min

    Hi all,
    I am getting the seconds value at input & I want to convert it to HH:MMS format..How can I proceed?
    Please guide me.
    Thank you.
    Vaibhav Gandhi
    B.E. Instrumentation & Control,
    INDIA
    Solved!
    Go to Solution.

    You don't say what this 'input' is but if you want to display it on the front panel, all you have to do is this:
    Attachments:
    Time Display.png ‏9 KB

  • SQL Query Help/ Converts seconds to day:hr:mi:se

    I have query that returns value in seconds. How i will convert those seconds in DAY:HOUR:MIN:SEC in the same query? What will be the mathematical formulae or alogorithim for this?
    Thanks
    Munis Warsi
    null

    Seriously, you post 750+ lines of unformatted SQL statement and a completely unreadable and unformatted explain plan and you expect people to be able to help with that?
    From what I can see it looks like some sort of query against an Oracle APPS database, and there are numerous calls to PL/SQL functions in there, so you're creating a multitude of context switches between the SQL and PL engines... that's known to cause performance problems.
    Take a read of the discussions linked in the FAQ: Re: 3. How to  improve the performance of my query? / My query is running slow.
    And also consider if your question would be better asked in the Oracle Apps forum space instead.

  • To display Days Hours Mins Format based on business hours

    Hi,
    I want to display Days Hours Mins Format.
    I am Having two columns Like below,
    Col1 (in days)    col2 (In Hours : Mins)
    3days  4:5 
    In this first have to  add Col1 and Col2 (Here one day is equals to
    9 hours ) so the addition is 31.5
    from this 31.5 i should display 3 Days 4 Hours 30 Mins because 31.5 contains 3 (9 hours) days 4 Hours and .5 is equals to 30 mins.
    Kindly please help me in this,
    thanks in advance.
    GVRSPK VENI

    Hello gvespk,
    Regarding your description, are you looking for some sample as below?
    DECLARE @T TABLE
    ID VARCHAR(99),
    SubID INT,
    Days INT,
    Hours FLOAT
    INSERT INTO @T VALUES
    ('abz', 1, 2, null)
    ,('abz', 2, null, 3 )
    ,('abz', 3, 3, 4 )
    ,('abz', 4, null, null )
    ,('abz', 5, 2, null )
    ,('abz', 6, 1, 5 )
    ,('abz', 7, null, 2 )
    ,('abz', 8, null, null )
    ,('abz', 9, 2, 3 )
    ,('abz', 10, null, 2.5 );
    SELECT SUM(DAYS)+FLOOR(SUM(HOURS)/9) DAYS
    , FLOOR(SUM(HOURS)-FLOOR(SUM(HOURS)/9)*9) AS HOURS
    , (SUM(HOURS)-FLOOR(SUM(HOURS)))*60 MINUTES FROM @T
    DAYS HOURS MINUTES
    12 1 30
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Date difference in Days,hours minutes and seconds.

    Hi All,
    I have two date Suppose one is getdate() and other one is gatedate() +1 .I have to show the difference, currently I used a datediff in the stored proc which just shows the difference of the days :( but i need to show the difference in days:hours:minutes:seconds if possible.
    its a countdown with the current date. Like the two fields are sale_start_date and sale_end_date. Hope i am clear.
    Please let me know ASAP thanks in advance.Can anyone help me?all help is great help.
    Say the difference of
    12/6/2007 7:00:00 AM, 12/8/2007 8:00:00 AM  as 2 days 1:00:00)
    Thanks
    N

    One of the problems of using DATEDIFF when dealing with either seconds or milliseconds is that this function will result in execution errors if the start and end dates span then entire domain of possible dates.  Below is an alternative that seems to work over the entire date domain.  A couple of things to note:
    1. This select converts the days and seconds of each date into BIGINT datatypes to avoid the overflow error
    2. This select uses a CROSS APPLY operator; in this case I chose CROSS APPLY to suggest the possibility of converting this select into an inline table function.
    I suspect that if you dig around this forum and the net that you will find a better routine, but here is yet another alternative:
    declare @test table
    ( startDate datetime, endDate datetime)
    insert into @test values
    ('6/1/9', getdate()),
    ('6/9/9 15:15', '6/10/9 19:25:27.122'),
    ('6/9/9 15:15', '6/10/9 13:25:27.122'),
    ('6/9/9', '6/10/9 00:00:01'),
    ('1/1/1760', '12/31/2999')
    select
      startDate,
      endDate,
      [Days],
      [Hours],
      [Minutes],
      [Seconds]
    from @test
    cross apply
    ( select
        cast((endSecond - startSecond) / 86400 as integer) as [Days],
        cast(((endSecond - startSecond) % 86400) / 3600 as tinyint) as [Hours],
        cast(((endSecond - startSecond) % 3600) / 60 as tinyint) as [Minutes],
        cast((endSecond - startSecond) % 60 as tinyint) as [Seconds]
      from
      ( select
          86400 * cast(convert(integer, convert(binary(4),
                        left(convert(binary(8), startDate),4))) as bigint)
            + cast(convert(integer, convert(binary(4),
                right(convert(binary(8), startDate),4)))/300 as bigint)
          as startSecond,
          86400 * cast(convert(integer, convert(binary(4),
                        left(convert(binary(8), endDate),4))) as bigint)
            + cast(convert(integer, convert(binary(4),
                right(convert(binary(8), endDate),4)))/300 as bigint)
          as endSecond
      ) q
    ) p
    /* -------- Sample Output: --------
    startDate               endDate                 Days        Hours Minutes Seconds
    2009-06-01 00:00:00.000 2009-06-22 08:28:36.670 21          8     28      36
    2009-06-09 15:15:00.000 2009-06-10 19:25:27.123 1           4     10      27
    2009-06-09 15:15:00.000 2009-06-10 13:25:27.123 0           22    10      27
    2009-06-09 00:00:00.000 2009-06-10 00:00:01.000 1           0     0       1
    1760-01-01 00:00:00.000 2999-12-31 00:00:00.000 452900      0     0       0
    (5 row(s) affected)
     EDIT:
    I based the routine more-or-less on Thilla's reply.
    Kent Waldrop

  • How to get two date difference in Day/hour/min/secs pl

    First of all,
    Hello to All, i am new to Oracle DB, but i have little experience in Other Database such as Sybase, sql server etc
    please kindly help me
    in DoctorChart table i have DocName,Id#,Citcotype,Medtype,AdmitDate,DischargeDate(both admitdate & Discharge date is date formatted columns)
    so how can i get the below differenceTime (which means Dischargedate-Admit Date in below format i.e, Day,Hours,Minutes,Seconds...)
    DoctorName, ID #, Citco type, MEDtype, DifferenceTime
    ========= === ======= ======= ===========
    Dr. KindaEmesko, 20045, Replace OutCard, ICH, 0 day 9 hours 11 minutes
    Dr. KindaEmesko, 20098, Replace OutCard, ICH, 1 day 2 hours 34 minutes
    Dr. KindaEmesko, 20678, Replace OutCard, ICH, 2 day 23 hours 52 minutes
    Dr. KindaEmesko, 20212, Replace OutCard, ICH, 4 day 1 hours 00 minutes
    Dr. KindaEmesko, 20345, Replace OutCard, BED, 3 days 14 hours 15 minutes
    Dr. KindaEmesko, 20678, Replace OutCard, BED, 9 days 21 hours 52 minutes
    Dr. KindaEmesko, 20015, Signature Overlay, Rest, 0 days 3 hours 29 minutes
    Dr. KindaEmesko, 45678, Signature Overlay, Rest, 0 days 1 hours 29 minutes
    Same way how can i get the Average Time for the above result (without ID columns)
    DoctorName, Citco type, MEDtype, Avg DifferenceTime
    ========= === ======= ======= ===========
    Dr. KindaEmesko, Replace OutCard, ICH, 2 day 1 hours 00 minutes
    Dr. KindaEmesko, Replace OutCard, BED, 6 days 17 hours 15 minutes
    Dr. KindaEmesko, Signature Overlay, Rest, 0 days 2 hours 29 minutes
    Please just tell me how to get the two dates difference as day/hour/minute format
    as well as how to get avg ( two dates difference as day/hour/minute format)
    Please Help me
    Thanks in advance

    Well, instead of all these suggested manipulations you can simply use intervals. Oracle uses day as a unit in date arithmetic, so Dischargedate-Admit Date is number od days between two dates. Built-in function numtodsinterval can be used to convert it into interval. For example:
    SQL> with t as (
      2             select trunc(sysdate) - 2 Admit_Date,
      3                    sysdate            Discharge_Date
      4               from dual
      5            )
      6  select  numtodsinterval(Discharge_Date - Admit_Date,'DAY') Hospital_Stay
      7    from  t
      8  /
    HOSPITAL_STAY
    +000000002 00:01:08.000000000
    SQL>  SY.

  • How to show number of days:hours:min:second

    Hi !
    Need your help on this one:
    I have to calculate the number of (  Days;Hours:Minute:Second  ) that a ticket have been opened
    But I have a problem to display the format that I want:  DD:HH:MM:SS
    EX:the ticket have been opened 2011-05-03 11:00:00
    first I create a formula to show number of second to show how long the ticket have been opened since the currentDate in seconds
    Formula Name is:
    {@number of seconds OpeningTime}
    Crystal Syntax:
    DateTimeVar dt1:= {@DTOpenDate};
    DateTimeVar dt2:= {@CurrentDateTime};
    If dt2 >= dt1 Then
    NumberVar ds:= (Date(dt2) - Date(dt1))*86400; 
    NumberVar hs:= (Hour(dt2) - Hour(dt1))*3600; 
    NumberVar ms:= (Minute(dt2) - Minute(dt1))*60;
    Numbervar ss:= Second(dt2) - Second(dt1);
    NumberVar ts:= dshsms+ss)
    Else
    NumberVar ds:= (Date(dt2) - Date(dt1))*86400;
    NumberVar hs:= (Hour(dt2) - Hour(dt1))*3600;
    NumberVar ms:= (minute(dt2) - Minute(dt1))*60;
    NumberVar ss:= Second(dt2) - Second(dt1);
    NumberVar ts:= dshsms+ss)
    then I create another formula to display the format that I want:Ex:if the ticket have been opened for about 25hh:00mm:00ss
    i want to show 01:01:00:00
                             DD:HH:MM:SS
    Formula name: {@DTConversionOpeningTime}
    I use Crystal Syntax:
    WhilePrintingRecords;
    StringVar Days1;
    StringVar Hours1;
    StringVar Minutes1;
    StringVar Seconds1;
    NumberVar Duration:=0;
    Duration:= {@number of seconds OpeningTime};
    If Duration < 0 Then
      "Cannot have a time less than zero"
    Else
      (Days1:=ToText(Truncate(Duration/86400),0);
    Hours1:=ToText(Truncate(Duration/3600),0);
      Minutes1:=ToText(Truncate(Remainder(Duration,3600)/60),0);
      Seconds1:=ToText(Remainder(Remainder(Duration,3600),60),0));
    //Display format
      (if length(Hours1) < 2 then '0')+ Days1 + ":" +
      ["0",""][length(Hours1)]+ Hours1 + ":" +
      ["0",""][length(Minutes1)] + Minutes1 + ":" +
      ["0",""][length(Seconds1)] + Seconds1;
    Thanks for your help

    Find a solution, see thread:
    Re: Converting a calculated field into format of dd:hh:mm:ss answered by Jason Long

  • Convert :-  Minutes to Days:Hours:Minutes

    Hi Friends ,
    I want to convert the time value from MINUTE to  HH : MM : SS  
    I mean in input i have to pass  200 Minutes and in Output i want to get the no of hr and minutes in the format  03 : 20  ( HH:MM) . I have used the FM "CONVERSION_EXIT_SDURA_OUTPUT" for this .
    This works fine for  time input values upto 5 digits  like  ( 20000 minutes) =  333:20 (HH:MM) ,
    when the input value is more than 5 digits , ex - 200000 this FM does not work .
    Is there any FM where i can get the conversion from MINUTE to HH :MM:SS  or from Minutes to DAYS :HPURS:MINUTES .
    I have searched SDN , but i dint get the exact FM which i want ,
    If any body has any idea on the same please guide me on the same .
    Regards
    Parbhudutta

    Thanks all for all of your valuable inputs .
    IBy using FM : MONI_TIME_CONVERT  , i am able to get  HH:MM:SS  format data by giving input as seconds .
    But the issues i have is , i have  data as input in seconds which is noear to a 10 digit number like
    200000000 seconds , which does not work  for this FM .
    I have input data in MINUTES which is near to 10 digit , exmp -  239879798 minutes . So i want to convert this no to ( DAYS : HOURS : MINUTES : SECONDS )
    Other FMs that has been given by you guys i have checked but i am not able to get exactly what i want .
    Anyway thanks again .
    Reagards
    Prabhudutta

  • How to configure JSpinner to accept number of hours (with mins and secs)

    I'm having a problem trying to figure out a simple way to enable a JSpinner to do allow the input in this format:
    n hours : n minutes : n seconds
    ex: 100 : 0 : 0, 1:59:59, 25:30:00
    Where n hours could be from 0-n (not restricted by 24 hours) and minutes and seconds are, of course, < 60. That is, I can enter number of hours, not a date, or a specific time in a day.
    I'm thinking the only way to do this is with a custom spinner model and custom editor? Or is there a simple way I can make the date model in spinner to allow me to do this?
    Thanks

    import java.awt.*;
    import javax.swing.*;
    import java.util.*;
    public class Test2 extends JFrame {
      public Test2() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container content = getContentPane();
        content.setLayout(new FlowLayout());
        content.add(new MySpinner());
        setSize(300, 300);
        setVisible(true);
      public static void main(String args[]) { new Test2(); }
    class MySpinner extends JSpinner {
      public MySpinner() {
        setModel(new SpinnerDateModel(
          new GregorianCalendar(2004,0,1,0,0,0).getTime(),
          null, null, Calendar.DAY_OF_YEAR));
        setEditor(new DateEditor(this,"HH:mm:ss"));
    }???

  • Converting millisecs to min and sec

    I have to turn milliseconds into minutes and seconds for an
    extra I am using. (Unfortunately the one command that I really need
    only does TMSF (Track, minutes, seconds, frame). Everything else
    uses milliseconds. So say I have 164000 milliseconds, that's 2.73
    minutes. I need to take the 2 and put it assign it a variable then
    I need to take the .73 and turn it into seconds, that 43.8 (44)
    seconds. And I need to assign that a variable. So that I can get my
    variables into
    dmm_CDExtPlayFromTMSF(gTrack, gMin, gSec, 0)
    Don't worry about the last number (frame), I don't know what
    that's all about yet.
    Here is my sad start
    --gMark is the milliseconds
    gMin = gMark/60000 (and ignore anything after the decimal
    point WITHOUT ROUNDING UP OR DOWN)
    gSec = ??
    Basically, I want to parse not round the result of
    gMark/60000
    Can anyone show me the way to do this?

    Thank you. That got me my integers, but now I get an error
    message:
    integer expected
    dmm_CDExtPlayFromTMSF(gTrack,gMin,gSec,0)
    1
    Well last I checked 1 is an integer. It's not "1".
    Here is the full script:
    global gTrack, gMark, gMin, gSec
    on mousewithin
    set the moveablesprite of Sprite 9 to true
    cursor 293
    ConvertFromMillSecs
    ScrubMusic
    end
    on MouseDown
    dmm_CDExtPause()
    end
    on ConvertFromMillSecs
    vSeconds = gMark / 1000
    vMinutes = vSeconds / 60
    vHours = vMinutes / 60
    vMinutes = vMinutes mod 60
    vSeconds = vSeconds mod 60
    if vHours then
    if vMinutes < 10 then
    vMinutes = "0"&vMinutes
    end if
    vString = vHours&":"&vMinutes&":"
    else
    vString = vMinutes&":"
    end if
    if vSeconds < 10 then
    put "0"&vSeconds after vString
    else
    put vSeconds after vString
    end if
    the itemDelimiter = ":"
    tMin = vString.item[1]
    tSec = vString.item[2]
    the floatPrecision = 0
    gMin = float(tMin)
    gSec = float(tSec)
    return vString
    end
    on mouseUp
    dmm_CDExtPlayFromTMSF(gTrack,gMin,gSec,0)
    end
    It doesn't mind the gTrack which is a variable for an
    integer. So why not gMin, or gSec?

  • Converting seconds to hrs, and minute

    I have never used function, is there a way to convert without using the declare... 
    Hi, 
    I have three columns, hour(s), min(s), sec(s)
    I can add it up, but will like to convert it into. hrs, mins and sec.
    this is how, i am adding it up into seconds.
    SELECT ((TotalTimeSpentHrs*60*60)+(TotalTimeSpentMin*60)+(TotalTimeSpentSec))AS totaltime
    FROM EST1
    how can I convert it. thanks

    use a function like this
    CREATE FUNCTION GetTimeParts
    @Seconds int
    RETURNS TABLE
    AS
    RETURN
    SELECT @Seconds/3600 AS HourPart,
    (@Seconds%3600)/60 AS MinutePart,
    (@Seconds%60) AS SecondPart
    GO
    Then we can invoke it like
    SELECT * FROM dbo.GetTimeParts(144072)
    which means 144072 seconds equivalent to 
    HourPart MinutePart SecondPart
    40 1 12
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page
    i get it , what of if i want to populate a column in a table with the result, what variable will a pass into 
    SELECT * FROM dbo.GetTimeParts(xxxxxxx)say the column name is timespent
    What you asked for was 3 columns in output. How do you store it in a single column?
    Or do you mean you want single value as xx hours yy minutes zz seconds?
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page
    yes i mean, mean you want single value as xx hours yy minutes zz seconds?

  • I subtract two dates and have total seconds. How to convert seconds to.....

    days/hours/minutes/seconds.
    Does anyone know how to convert a # that equals total seconds to days/hours/minutes/seconds??
    Thanks as always
    Adam

    i guess you can mod the number with 360 first and get the number of days, then get the remainder and mode by 60 get the hour and so forth, maybe a better way is using recursive function to return you a final result. Hopefully this will help, don't complain on me if I am misleading you since this is my first time try to help.

  • Convert date/time to HEX command and write to a bin file

    Hello,
    I have to do the following thing. I have the date/time string, let's say 08:45:23, 12.08.09, where the hour, the minutes, the seconds, the day, the month and the year represent hex number or in other words I have the following command:
    Byte 0 - Byte 5
    0x08; 0x45; 0x23; 0x12; 0x08; 0x09;
    Now I want to write this command in a binary file in order to send thefile later throught serial RS232 connection.
    Now, I am not sure whether I write the command in the binary file in the correct format. What I simply do is to write it as a string
    ("084523120809"). Is this the correct way. I guess no, because when transmitted it does not work as expected.
    How can I write this string as a HEX command in the binary file?
    Thanks for the replies in advance
    IG
    Message Edited by igurov on 08-12-2009 01:51 AM
    Attachments:
    1(2).JPG ‏39 KB

    Do you know the difference between decimal and hex values? It's not the same, that the whole point, and it's why it doesn't make sense. Decimal 32 is not the same as hex 32. These are two different values, even though they both have the digits "3" and "2". The hex value will be the same as the decimal value up to the value of 9. In your example the hour is 8. In decimal this is 8, in hex this is 8. The minutes is 45. That's decimal. In hex, this is 2D, not 45, as you claim in your example. Hex 45 is a completely different number (and a completely different "pattern").
    Attachments:
    time hex.vi ‏12 KB

  • 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

Maybe you are looking for

  • Report Builder 2.0 loses parameter Null default value when deployed

    When a parameter is set to a default value of (Null) and the report is saved to the sever, the default is lost when the report is re-opened in RB2.  This problem doesn't seem to occur in BIDS.  I've tried to use an expression to set the value to Syst

  • How to get previous month data from current month values

    Hi Experts, I have made one universe from BW Query in which Fiscal year period is entered in interval. I have made a universe from that and want to develop webI reports on top of that. In my webI reports, i have used one cross tab. In Rows section i

  • RMAN recovery from tape and disk?

    Hey Guys, Here is my scenario: - I have Oracle 10g and I am using RMAN to backup to disk and then I use Networker to backup on tapes from disk (retention is set to 30 days on tapes). On RMAN - my retention policy is set to recovery window of 5 days a

  • How can I test if a given DisplayObject is obscured by any other DisplayObject on the same stage?

    I'm trying to write a function     internal function isObscured(o: DisplayObject, p: DisplayObject): Boolean; which tells whether the given object o is partially or completely obscured by the object p. I already tried using hitTestObject and hitTestP

  • Expired Updates Removal - Best Practices

    http://blogs.technet.com/b/configmgrteam/archive/2012/04/12/software-update-content-cleanup-in-system-center-2012-configuration-manager.aspx I was searching for best practices for removing expired updates from environment and found this useful link.