Seconds to minute and seconds conversion

Say I have an int:
int time = 1500
which means that there are 1500 seconds in time and I would like to convert that to the format of
25:00
which is 25 minutes and 0 seconds
what I did so far is
System.out.println(time/60 + time%60);and it always gives me the result of 25:0 instead of 25:00, how do I deal with this??

System.out.printf("%1$02d:%2$02d\n",time / 60, time % 60);{color:#000080}See{color}
http://java.sun.com/javase/6/docs/api/java/io/PrintStream.html#printf(java.lang.String, java.lang.Object...)
http://java.sun.com/javase/6/docs/api/java/util/Formatter.html#syntax
{color:#000080}db{color}

Similar Messages

  • Field with time in minutes and seconds

    Dear community,
    first of all, I am using Apex 3.1 on Oracle 10g, if this is necessary to know (yes I know, an old version, but given by the company I'm working for). After I've developed a few applications in Apex, thank to the forum and all the answers inside, I came to a problem that I could not solve:
    I want to have a normal text field, where the user can enter a duration of an event (e.g. "3:45" or "2:30"). That duration will allways be in the format "MM:SS". No hours, no milliseconds... But how can I save the given values in the database, so in which format? A varchar would be a possibility, but I want to build a report later on, where there is a sum of the times. And how to get a sum of varchar?! But how to make it clear to Apex and Oracle DB that the users gives in a time and not a varchar? The only thing oracle offers is a date field, but I want to save a time and not a date!
    Does anybody has a clue for me, cause it seems to me, that possibly I just don't know what I'm searching for, cause people must have had this problem before!?
    THanks for your help!
    Regards
    hoge

    But how to make it clear to Apex and Oracle DB that the users gives in a time and not a varchar? The only thing oracle offers is a date field, but I want to save a time and not a date!All APEX items are character strings, so implicit or explicit conversion is required when the values are stored in database columns. For the recommended <tt>INTERVAL DAY TO SECOND</tt> columns, use <tt>TO_DSINTERVAL</tt> to perform the conversion.
    Use <tt>EXTRACT</tt> to get the minute and second values from the <tt>INTERVAL</tt> going in the other direction.
    but I want to build a report later on, where there is a sum of the times.A user-defined aggregate function can be created to sum <tt>INTERVAL DAY TO SECOND</tt> values: here's an example.
    APEX's lack of built-in support for summaries on <tt>INTERVAL</tt> types can be worked round by including the sum in the report query using a </tt>UNION</tt>:
    SQL&gt; with test_data as (
      2      select
      3                rownum n
      4              , numtodsinterval(ceil(dbms_random.value(0, 3600)), 'SECOND') t
      5      from
      6                dual
      7      connect
      8                by rownum &lt;= 10)
      9  select
    10            n
    11          , t
    12          ,    to_char(extract(minute from t))
    13            || ':'
    14            || to_char(extract(second from t), 'fm00') t1
    15  from
    16            test_data
    17  union all
    18  select
    19            null
    20          , sum_dsinterval(t)
    21          ,    to_char(extract(hour from sum_dsinterval(t)))
    22            || ':'
    23            || to_char(extract(minute from sum_dsinterval(t)), 'fm00')
    24            || ':'
    25            || to_char(extract(second from sum_dsinterval(t)), 'fm00')
    26  from
    27            test_data
    28  order by
    29            1 nulls last
    30  /
             N T                              T1
             1 +000000000 00:04:46.000000000  4:46
             2 +000000000 00:07:05.000000000  7:05
             3 +000000000 00:31:11.000000000  31:11
             4 +000000000 00:53:16.000000000  53:16
             5 +000000000 00:19:02.000000000  19:02
             6 +000000000 00:57:12.000000000  57:12
             7 +000000000 00:43:29.000000000  43:29
             8 +000000000 00:03:11.000000000  3:11
             9 +000000000 00:16:40.000000000  16:40
            10 +000000000 00:20:49.000000000  20:49
               +000000000 04:16:41.000000000  4:16:41A custom named column (row) report template with conditional templates can be used to layout and format such a report so that the summary row(s) are properly handled.

  • How to conver this System.nanoTime() into Hours,minutes and second

    I am getting my Total time with the help of this function ie System.nanoTime(). But i want to Display in the form of Hours,minutes and second.
    So can any one plz tell me that how i will do this conversion.

    If it's less than 24 hours you can use Calendar. or SimpleDateFormat. Add the epoch time for some convenient midnight to the milliseconds value (divide nanos by 1000000).
    Otherwise it's just successive division and remaindering.
    Probably nanos is higher resolution than you need, milliseconds is easier.

  • How can i use minutes and seconds in my job interval

    Sir,
    I want to use minutes and seconds in my job interval.
    suppose i want to run my job on 1:15:10 AM what will be the syntax. my code is below.
    Declare
    jobno number;
    BEGIN
    DBMS_JOB.SUBMIT(jobno,'DEL_DEPT;',trunc(SYSDATE + 1) + (1/24),'trunc(SYSDATE + 1) + (1/24)');
    END;
    Thanks in advance.

    Declare
    jobno number;
    BEGIN
    DBMS_JOB.SUBMIT(jobno,'DEL_DEPT;','trunc(SYSDATE + 1) + 4510/86400','trunc(SYSDATE + 1) + 4510/86400');
    END;
    number of hours in a day = 24
    number of minutes in a day = (24 * 60) = 1440
    number of seconds in a day = (24 * 60 * 60) = 86400
    4510 is the number of seconds in 1 hour 15 minutes and 10 seconds.

  • How can I make a row of cells containing 3-digit decimals, who's values resulted from calculations within the spreadsheet, appear as durations of minutes and seconds?

    Row 6 in this spreadsheet is the result of Row 2/Row 3 as evidenced by the formula listed while Cell Y6 selected. How can I make the values in this row appear as durations of minutes and seconds rather than 3-digit decimals? For example, rather than appearing as 9.84 I would like the value of Cell Y6 to appear as 9:50 or 9min 50sec. (obviously .84x60seconds 50 seconds). I tried changing the cell formats from "number" to "duration," but no change is made. Using the "duration" format does however work if I am manually entering the decimal value into the cell rather than allowing it to result from another caluclation within the spreadsheet. Is there a solution to this within Numbers '09? You can see why I would want the "pace" displayed in minutes and seconds. Thanks in advance!
    Ryan

    Hi Ryan,
    You wrote:
    "The problem is that my "Distance" is a row of automatically generated values resulting from ((Row1/60)*Row 6). Changing the format of Row 1 to minutes causes row two to be expressed as a duration, which obviously it shouldn't because it is a distance. The spreadsheet has to be designed so that all I have to manually input on each entry are Row 1 Values (Time) and Row 6 Values (Average Pace). The rest of the cells must be automatically poulated as a result of formulas."
    I'm assuming that where you say "Row 1" in this you mean "Row 2", which is labeled "Time" in the example in the OP.
    In the original post, you presented a formula from cell Y6. Replacing the Header labels in that formula's cell reference with the Addresses of the referenced cells, the formula was:
    Y6: =Y2/Y3
    In this post, you are saying that Y6 contains entered data: "...all I have to manually input on each entry are Row 1 Values (Time) and Row 6 Values (Average Pace).
    Which is correct?
    Regards,
    Barry

  • I bought 2 songs from itunes and one plays for 43 seconds and stops and the other places for 1 minutes and 40 seconds and stops

    I bought the song "You" by Chris Young and the song "Yesterday" by the Beatles and they played fine for a period of time.  However one day about 4 months ago, when I would play either song, the song would play normal for an amount of time ( "You" for 1 minute and 42 seconds and "Yesterday" for 29 seconds) and then the song would stop playing on my iPod touch 3rd gen.  When I played the songs on iTunes, it would just go to the next song.  I contacted Apple support through email, and they responded promptly with a reponse and a solution!  The lady helping me accessed my account and made it so that the song "redownload" I guess because thats what happened when I signed on to iTunes and the two songs were loading.  Well I think I heard the songs once or twice and now they are doing it again!  The songs stops at those same times and will not play.  What is the solution?

    - Try a reset. it cures many ill and nothing is lost
    Reset iPod touch:  Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears
    - Does it play in iTunes on the computer?
    - Delete the song and redownload it by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    - Ask iTunes for a redownload.
    How to report an issue with Your iTunes Store purchase

  • HP Officejet Pro 8000 - Press Print - wait 2 minutes and 30 seconds before printing

    I have a new Officejet Pro 8000 non-networked printer. When I hit the print button, it does a very long initialization process that takes exactly 2 minutes and 30 seconds before I can print anything. I find this delay very annoying. I thought the printer must be defective so I went to Office Depot and played with one of theirs and it does the same thing. I've seen laser printers that took awhile to print, but I've never seen an inkjet printer take this long. I can't believe HP engineers thought this would be acceptable. I can't help but wonder just what the printer is doing for 2:30 minutes every time the printer is turned on and why this is necessary.
    I have a friend with the printer just below it in price and function (Officejet Pro 6000) and his printer is ready to print as soon as the Print button is pushed.
    Are there any other Officejet Pro 8000 owners out there that find this startup delay objectionable or am I being unreasonable?

    The start-up time is my main complaint about this printer, but there is one other thing that I find very annoying. My old HP printer had an envelope slot. If I wanted to print an envelope or a check I could just insert it into this slot and quickly print it. Not this one. If I want to print an envelope, I have to remove the cover over the paper, remove all the paper, slide the side bars in and then print the envelope (or check)  and then go through the whole process in reverse. It's so inconvienent that I just hand write my envelopes and checks now. Is this progress? HP needs to hire some new engineers or fire some old ones.

  • How do I log the time in hours, minutes and seconds to a table

    Hi
    I'm a relatively new user of Labview. I am currently writing a program that logs the temperature of an oven and the current time to a table and graph. I am using a GPIB card to communicate with the oven. I have used the Get Date/Time string to get the time and the Decimal String to Number to convert the time to a number which I have then put into an array which goes to a table and graph. My problem at the moment is that the time is being logged in hours only. I need to log the time in hours, minutes and seconds. Can you tell me how I can do this?

    Hi,
    I can see the setup now. The decimal string to number will only ever give the hours, since the ':' character is not part of a number, so won't translate. Use the code I attached previously to get the time as a timestamp, and then go from there.
    I've made some modifications, although you'll need to alter the file save to take into account the double precision number
    for the timestamp is now 3E+9 (since it's seconds since 1904!!), but since you're writing to a comma separated values (or tab deliminated) style file, this shouldn't be a problem. You could always do a textual save from the table instead.
    Thanks
    Sacha Emery
    National Instruments (UK)
    // it takes almost no time to rate an answer
    Attachments:
    temp time program.vi ‏98 KB

  • When rendering with Adobe Media Encoder, the sound only starts playing at 1 minute and 20 seconds

    So I have this problem: I have a video which is an hour long and when I try to render it via AME the result will have the audio of the video starting at around the 1 minute 20 mark. I render to the YouTube 1080p preset.
    What I have tried to fix this is:
    - use .wav instead of .mp3 (didn't work)
    - use After Effects itself to render the video (this worked)
    - change the video start time to 1 minute and 20 seconds and then made AME start the render at that (didn't work)
    - re-render (didn't work even on different presets)
    It's also not my audio file because I've tried rendering it with the audio starting at 1:20 and then the track was playing from the start.
    The video contains one audio track and one video and the project file is in After Effects.
    Is my AME bugged or am I doing something terrible wrong?
    Hope to hear from you guys.
    PS: I really don't want to render via After Effects, due to file size.

    I'm having a very similar problem. I just purchased a larger SD card thinking it was the card but it's definitely Media Encoder.
    Mine is also crashing in the middle of renders and causing my computer to crawl.

  • The sc command, (service control manager), takes 3 minutes and 30 seconds to create a service on Windows 8.1. and 2012R2

    Unique circumstance: SC create This takes 3 minutes and 30 seconds on one domain when
    using Windows 8.1 & 2012R2.  We have two domains:  D1.com
    and D2.D1.com.  If we place a Windows 8.1 or 2012R2 VM on the D2.D1.com
    domain and run the sc command to create a service using a D2.D1.com domain
    account it will take 3 minutes and 30 seconds to create the service.  It
    will create the service successfully, but will take 3 minutes and 30
    seconds.  If we use the sc command to create a service using the obj=
    parameter and use an account which is a member of the D1.com domain as the
    parameter, the service is created immediately. Note: using a windows 8 VM
    on D2.D1.com domain it does not exhibit the same behavior.  Also note that
    placing a Windows 8.1 VM on the D1.com domain does not exhibit the same
    behavior as well.  Consequently, this leads us to believe that the sc
    command is timing out on the validation of the domain account and then using a
    different validation method which is successful.<o:p></o:p>
    Commands
    used:<o:p></o:p>
    sc create test binpath= C:\windows\test.exe   (logged in as D2.D1.com
    user)    <o:p></o:p>
    sc create test binpath= C:\windows\test.exe obj= D1\username password= something<o:p></o:p>

    Hi,
    Based on my understanding, when you run sc command to create service, it takes long time, but when use sc command to delete the service, it runs fast. right? If so, the issue should be related with the command you used.
    I also would like to suggest you refer to the below link to use sc to create service, we may also post in the MSDN forum:
    http://social.technet.microsoft.com/Forums/en-US/fe9d60c9-564b-4e82-b27d-9d0effaf87a2/creating-a-service-using-sc?forum=winservergen
    Regards,
    Yan Li
    TechNet Subscriber Support
    If you are
    TechNet Subscription
    user and have any feedback on our support quality, please send your feedback
    here.
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Since syncing my Ipod classic three days ago, the songs will only play the first three minutes and five seconds. Then it just stops. After a little while, it moves on to the next song.

    I have an old iPod Classic, 5th generation with video 30 GB. I sync via a pc. Since syncing it three days ago, the songs will only play the first three minutes and five seconds. Then it moves on to the next song or if it's the last song, it goes back to the menu. I just synced again and it it still doing it.It also has a small group of dots near the middle of the screen that weren't there before.Has anyone else had this problem or know how to fix it?  Thanks.

    Please disregard this question. I have a better worded version coming up.

  • How to insert degree, minute and seconds in a cell

    How to insert degrees, minutes and seconds in a cell. Need operate trigonometry functions

    Hi harrigorri,
    Does this work for you?
    Degrees
    Minutes
    Seconds
    Decimal degrees
    128
    26
    45
    128.445833333333
    Formula in E2
    =B2+C2÷60+D2÷3600
    Font size enlarged to show the division symbol ÷
    Regards,
    Ian.
    Edit: 3600, not 360

  • Execution time in minutes and seconds

    In the UUT Report, the Execution Time displays in seconds.  How can I get that to display in minutes and seconds.

    I'm just now getting to this, and I've decided to address this in the reportgen_html.seq.  In the step labelled "Add Execution Time", the expression reads,
    Locals.Header += "<TR><TD NOWRAP='NOWRAP'><B><LI>" + ResStr("MODEL", "RPT_HEADER_EXEC_TIME") + "</B><TD><B>" + (PropertyExists("Parameters.MainSequenceResults.TS.TotalTime") ? Str(Parameters.MainSequenceResults.TS.TotalTime, Parameters.ReportOptions.NumericFormat , 1, True) + ResStr("MODEL", "RPT_HEADER_SECONDS") : ResStr("MODEL", "RPT_NOT_APPLICABLE")) + "</B>\n"
    I found the RPT_HEADER_SECONDS constant and changed it to _MINUTES and changed the string.   I divided the Parameters.MainSequenceResults.TS.TotalTime by 60, and this all seems to work.  The only thing that's not working is that I'm updating the Parameters.ReportOptions.NumericFormat, and no matter what I do it keeps showing me 13 decimal points. 
    The Parameters.ReportOptions.NumericFormat is set to  %$.13f  (but I've tried several variations). 
    I just want it to display something like   21.63 minutes.  Also, what is the $ doing in that expression

  • APPHANGB1 when browsing the web, or just keeping it open. Happens once in a 5 minutes, and it freezes for 30 seconds. I found many people who have this problem too ....

    APPHANGB1 when browsing the web, or just keeping it open. Happens once in a 5 minutes, and it freezes for 30 seconds. I found many people who have this problem too ....

    Odds are only someone that develops apps for iOS would have access to whatever this is and, even then, this information may still not be available.
    I would do a backup of your phone & then erase it and restore from the backup to see if the odd behavior goes away. If so, something went funny with your update the first time around. If not, there's something in your backup that's making the phone throw a fit.
    I resolved my battery issues (more or less) by disabling the "set date/time automatically" setting. I haven't re-enabled it yet but my battery life has been much better with it off.
    ~Lyssa

  • 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

Maybe you are looking for

  • Remote app on iPhone and multiple speakers - I have to tap multiple times

    I have a set-up with an Apple TV, iTunes on my iMac and a PC laptop plus 2 airport expresses throughout the house, all of those connected through airTunes. This allows me to play music from any of these iTunes/Apple TV to the aiport expresses. I have

  • In em, OS user credentials gives "The owner of the job is not registered O"

    In em manager, to do a back or recovery, you have to enter an operating system user: "To perform recovery, supply operating system login credentials to access the target database" For lack of any guidance, i tried the oracle user, which has full acce

  • Fetch files via http

    I have a flex application on one web server. The swf will fetch some rss xmls from other servers such as yahoo.com. I can do it by using httpserver. It works in flex builder3 when click "Run" button. But if the compiled swf deployed to web server. It

  • App Store browsing still rough around the edges

    So here is a frustrating experience with the App Store application. Not sure if this happens in iBooks, etc but I'm sure other people can validate. So I am browsing for an app I want to buy. Let's say I want to browse the entire apps for children sec

  • HELP - about sending files

    how can i transfer someone files as files and not as junk data in a packet if i have access to the output stream[i can write whatever i want to the packet i'm sending you] of the packets i send someone?