Convert "x milliseconds" to "A days B hours C minutes D seconds"

I'm trying to find an elegant way to convert:
"X milliseconds" pattern to "A days B hours C minutes D seconds"
Currently, I use multiplication and division to get the desired result.
But I was investigating if there's a way to do this using java class?
Thanks in advance for the help

What is your definition of a "day" and what other requirements are there? What does this hope to accomplish? If you define a day as 24 hours and couldn't care less about it's corrolation with a calendar then you're not talking about a Date anymore. The best way to accomplish that is probably to use division, which you said is what you're currently doing. If you actually want to calculate when something occurred on a calendar or how many calendar days, weeks, months or years have elapsed since then that's another matter entirely. You might store the time when it started and use that with a Calendar, or you might simply get the current time and subtract the elapsed time to find how long ago that was on a calendar.
You really needed to give more details, but at this point you've got an answer to just about every possibility.

Similar Messages

  • Regarding function module to convert hours to minutes and seconds to minute

    hi all,
        is there any function module to convert hours to minutes and seconds to minutes....if so please guided me....i hav req like this...want to convert all those to minutes[seconds and hours]....

    Hi,
    Use FM
    SD_CALC_DURATION_FROM_DATETIME
    Pass paramters like
    I_DATE1 16.09.2008
    I_TIME1 10:33:00
    I_DATE2 16.09.2008
    I_TIME2 19:00:00
    and you will get the result as below..
    E_TDIFF 8:27
    8 hours and 27 minutes...
    Now u can use this values of hours and minutes to get the exact wage type values... get the details from HR module and multiply it with the hours and minute and calculate it...
    Use Offsets and get the hour and minute value from E_TDIFF
    Hope it will solve your problem..
    Thanks & Regards,
    Naresh

  • Getting records where date got hour or minute or seconds

    Hi,
    I have a date column in database in this format.
    yyyy-MM-dd hh24:mi:ss
    now I would like to find all the records where it got either hour or minute or second.
    Thanks,

    SQL> create table test
      2  as
      3  select 1 id, sysdate dt from dual union all
      4  select 2 , trunc (sysdate) from dual
      5  /
    Table created.
    SQL>
    SQL> alter session set nls_date_format = 'dd-mm-yyyy hh24:mi:ss'
      2  /
    Session altered.
    SQL>
    SQL>
    SQL> select *
      2    from test
      3  /
            ID DT
             1 26-10-2009 15:50:42
             2 26-10-2009 00:00:00
    SQL>
    SQL> select *
      2    from test
      3   where trunc (sysdate) <> dt
      4  /
            ID DT
             1 26-10-2009 15:50:42
    SQL>
    SQL> Edited by: Alex Nuijten on Oct 26, 2009 4:07 PM

  • Convert days into days, hours and minutes

    Hi,
    In my report there is a column "# of Days (Submitted to Completed)" and the result I am getting is like 2.4, 3.5, 1.8 etc. Client requirement is to convert 2.4 days into days, hours and minutes (2 days 9 hours 36 minutes)
    The value of "# of Days (Submitted to Completed)" is calculated during ETL.
    Can you please tell me how to achieve this result.
    Thanks

    Create a formula where you could use the CAST function and calculate for the remainder by multiplying 24 for hours and 60 for minutes.

  • Converting days into hours and adding this hour to the time

    Hi Gurus!
    I ahve  a query that outputs the total time between two periods in one column , total number of days between two periods  in onne column. I want to combine those together and show it in hours . For example if the time column shows 7:41(7 hours  and 41 minutes ) and teh days column shows 1 day , I want to combine those two columns and show as one column i.e 24 hours plus 7 hours and 41 minutes as a total of 31 hours and 41 minutes. I had written the follwwing code in the query that calculated the two seprately , can anyone please tell me how to go about converting this hour into time format and then adding the two to get it in total number of hours and minutes in my query.
    concatenate vttk-datbg vttk-uatbg into lv_start_time.
        concatenate vttk-daten vttk-uaten into lv_end_time.
        gv_ftstm = lv_end_time - lv_start_time.
        gv_total_time = gv_ftstm+8(6).
        if not ( vttk-datbg is initial
              or vttk-daten is initial ).
          gv_total_days = gv_ftstm+0(8).
        else.
          clear: gv_total_days.
        endif.
        if not p_bl_lns is initial.
          read table gt_vttk with key tknum = vttk-tknum.
          if sy-subrc <> 0.
            append vttk to gt_vttk .
          else.
            clear: vttk-distz,
                   vttk-gesztda,
                   vttk-fahztda,
                   vttk-warztda,
                   gv_total_days,
                   gv_total_time.
          endif.
        endif.
    The gv_total_days have been declared as type P lenght 6, outlenth 10 and decimal 02, and
    gv_time as VTTK-FAHZTDA.
    Thnaks

    Does this help ?
    CONVERT DATE par_date TIME par_time INTO
              TIME STAMP par_timestamp TIME ZONE par_time_zone.
    also use fm:  SD_DATETIME_DIFFERENCE
    01/01/2009
    12:00:00
    01/02/2010
    11:00:00
    output:                             365
                                 23
    365 * 24 = tine in Hrs + 23 hrs

  • Convert hr:mm:ss to days

    Hello,
    Is there any FM to convert hr:mm:ss to days.
    Eg. 240000 to 1 days; 120000 to 0.5 days.
    Thanks,
    Shreekant

    Hello Shreekant,
    May be this can help you.
    [Convert :-  Minutes to Days:Hours:Minutes;
    Thanks,
    Jayant Sahu

  • How do I get a time value in days, hours and minutes returned to a cell from a calculation of distance divided by speed?

    How do I get a time value in days, hours and minutes returned to a cell from a calculation of distance divided by speed?

    Simon,
    you can use the duration function:
    B4=DURATION(0,0,B1/B2)
    you can further, format the cell as a duration like this using the cell inspector:

  • Calculation of planned costs in CS service order with 1 day = 8 hours

    Dear experts!
    What kind of possibilities do I have to calculate the planned costs in the CS service order (IW31) on the basis 1 day = 8 hours.
    Right now, when I create the operation with "amount of work" = 5 days, the system calculates 120 hours * x u20AC. My requirement would be, that the system calculates 40 hours * x u20AC.
    Do I have to change settings in transaction CUNI or can I use the work center to solve my problem? Or any other idea?  
    Kind regards,
    Jens
    Edited by: Jens Neßlage on Oct 28, 2009 6:28 PM

    Jens,
       You should be able to use the work center to solve this problem.Check the working hours in the operation work center and make sure its set to 8 hrs.This should solve your problem.
    Regards
    Narasimhan

  • I participated in getting the free download of Mountain Lion for new Mac owners. It took me three days to finally get a code to do it and when I tried downloading it, the estimated time was 74 days 17 hours. Now an error occurred. What do I do?

    I participated in getting the free download of Mountain Lion for new Mac owners. It took me three days to finally get a code to do it and when I tried downloading it, the estimated time was 74 days 17 hours. Now an error occurred. What do I do? I am very frustrated and just want the great software to download in a resonalbe time!

    Take your Mac to a location with a fast, relaible Internet connection that will be all yours during the duration of the download.
    If you want to complain, PLEASE call Apple and do so.
    Internet only downloads of OS X is completely stupid, it assumes everyone has reliable Internet everywhere and /or no data caps.

  • Standard function for returninf time difference in days and hours.

    Hello all,
                Can somebody tell me whether there exists some standard function module which can calculate the time difference and returns the calculated time in the form of days and hours ?
    e.g. the time difference between the date 1.12.2007 from 7.00 pm to the date 1.1.2008 till 9.00 pm is
    30 days  and 2 hours or 30 : 2.
    answer as soon as possible.
    Thanks and regards,
    me

    Thanks a lot ya..
    thats an absolutely correct solution to my problem.  )

  • How can I get max, min & average (hours with minutes) of fast 30 days data

    Table name:
    run_log
    TYPE VARCHAR2(10),
    SUBTYPE VARCHAR2(10),
    PROGRAM VARCHAR2(100),
    STATUS VARCHAR2(20),
    START_TIME      DATE,
    END_TIME      DATE
    How can I get max, min & average (hours with minutes) of fast 30 days data ?

    Hi,
    you have to use analytical functions:
    SELECT start_day,
           round(AVG(daily_avg)
                 over(ORDER BY start_day ASC RANGE BETWEEN INTERVAL '30' DAY preceding AND INTERVAL '0' DAY following)) AS moving_avg,
           round(MAX(daily_max)
                 over(ORDER BY start_day ASC RANGE BETWEEN INTERVAL '30' DAY preceding AND INTERVAL '0' DAY following)) AS moving_max,
           round(MIN(daily_min)
                 over(ORDER BY start_day ASC RANGE BETWEEN INTERVAL '30' DAY preceding AND INTERVAL '0' DAY following)) AS moving_min
      FROM (SELECT trunc(t.start_time) start_day,
                   AVG((t.end_time - t.start_time) * 24 * 60 * 60) AS daily_avg,
                   MAX((t.end_time - t.start_time) * 24 * 60 * 60) AS daily_max,
                   MIN((t.end_time - t.start_time) * 24 * 60 * 60) AS daily_min
              FROM run_log
             GROUP BY trunc(t.start_time)) t
    ORDER BY 1 DESCAnalytical functions are described in the Oracle doc "Data Warehousing Guide".
    Regards,
    Carsten.

  • How to convert decimal numbers to Hours and minutes

    Hi,
    I am using SSRS 2005. I want to convert decimal numbers to Hours and minutes.
    Say suppose, I am adding daily work hours and minutes and the total is 208.63.
    Here 208 hrs and 63 minutes. How to convert this to 209 hrs 03 minutes in SSRS.
    Any In-built function is there? or how to do using custom code?
    Appreciate your help.
    Regards,
    Bala

    suppose if field name is TotalDailyHours you can do it as below
    =CStr(Cint(Floor(val(Fields!TotalDailyHours.Value)) + ((val(Fields!TotalDailyHours.Value)-Floor(val(Fields!TotalDailyHours.Value)))*100)/60)) + ":" +
    Right("00" +Cstr(Cint(((val(Fields!TotalDailyHours.Value)-Floor(val(Fields!TotalDailyHours.Value)))*100) Mod 60)),2)
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • I need help to convert hours,minutes and seconds to seconds.

    Hi, I need help with the code on how to convert the hours,minutes and seconds to seconds. I don't know which formula to use so that I can get the results in total number of seconds. Thanks.

    Jos ("when in doubt: parenthesize correctly")Bracist.You're more right than you'd known: last week I climbed over a safety
    fence (which I wasn't supposed to do of course) to adjust the position
    of an optical measurement device we installed in a huge production
    machine in a factory. I stepped on some sort of hose; the end of that
    hose broke loose and hit me straight in the middle of my lower jaw. My
    front teeth feel wiggly now and my molars on the left of my lower jaw are
    not what they used to be. This Wednesday I get that all fixed at some
    dental clinic. Keep your fingers crossed because me+dentists == war.
    My tongue continuously keeps on reporting craters and disaster ;-)
    Jos, how's it going? Besides a possible loss of some teeth, I'm fine ;-)
    My Spring/Hibernate journey continues. I'm trying out Hibernate 3.2
    annotations and the Ant tools. So far, so good.Good to hear. At the moment I'm putting my teeth (sic) in that darn snmp
    stuff which simply refuses to work the way I want it and besides that I'm
    heavily involved in some of that SAP stuff. Spring is not in the vicinity for
    me in the next couple of months sadly enough.
    kind regards,
    Jos

  • Can edit event title, day, and hour, but *not* minutes - Help!

    I can edit everything about my calendar event title, day, and hour, but not the minutes. This is very annoying and I'm not able to have accurate calendar entries.
    It's like there' s a glitch in the program. Can it be reloaded/rebooted?
    Using iCal 3.0.8

    I have the exact same problem, and it is really driving me crazy...
    Any luck with it??

  • 48 Hours ago I started to upgrade to Mtn Lion on a now 10 day old IMac - 30 minutes ago I got the email with the content code and redeem code for the download from the app store - it said download was happening, but nothing happened for 30 min - FIX IT!

    48 Hours ago I started to upgrade to Mountain Lion on a now 10 day old IMac - 30 minutes ago I got the email with the content code and redeem code for the download from the app store - it said download was happening, but nothing happened for 30 min - HOW DO I (or you) FIX IT!?

    This is a User's Forum, yelling at us won't help. You have 90 days of customer support via telephone. Use them as they can interact with their system and hopefully get you back on track. Otherwise take it to them at the Genius Bar and have them make it good.

Maybe you are looking for

  • Saving tabs doesn't seem to work anymore for me in 4.0.1

    Since I've installed FireFox 4.0.1 the saving of tabs doesn't seem to work anymore. When I press exit I only receive the notification "are you sure you want to close x tabs?". When firefox or my computer crashes the tabs are saved, but when I try to

  • How to upgrade iPad2 to iOS5 without deleting my photos & apps etc

    I have an iPad 2 and it's been a long time since I did a sync and i don't have the computer any more. I want to upgrade to iOS5, I downloaded iTunes onto a PC and plugged in the ipad but it said it was going to erase everything. I don't care about mu

  • Help needed with updates!

    Every time I download updates to Photoshop CS6 via the application manager on Creative Cloud, it downloads fine but always fails on the update.  I have tried this twice now in the space of week.  Comes up with an error message but doesn't say what th

  • Satellite 5100, HID not supported!

    I have the problem that the MS Explorer Bluetooth Mouse is not supported by the BT stack of Toshiba. Is there any way to get it work on my Satellite 5100?

  • How do I get install wizard to install my Elements 10 upgrade?

    I just downloaded (from the Adobe site) Elements 10 to upgrade my Elements 6. Took over 2 hours but finally got to Windows InstallWizard ... started fine then this message: "Error 1335. The cabinet file 'Data14.cab' required for this installation is