Convert seconds to minutes 121 (seconds) to 2:01.

I receive a variable only in seconds. I'm trying to convert
it to minutes when greater than 60.
i.e. 121 (seconds) to 2:01.
Can anyone help with the code. I got this far:

quote:
Originally posted by:
Kronin555
<cfset minutes = duration / 60>
<cfset seconds = duration mod 60>
<cfoutput>#minutes#:#numberformat(seconds,'00')#</cfoutput>
Thanks so much! I was confused at first because the numbers
coming up with many decimal points making their accuracy pretty
much unreadable to me so I changed to:
int(minutes)#:#numberformat(seconds,'00')#

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

  • 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

  • Converting seconds to hours + minutes + seconds

    hey all,
    was just looking for the quickest way to convert seconds to hours + minutes + seconds
    eg, 18084 s is 5h, 1m, 24s.

    You can use the Apache Commons Lang DurationFormatUtils class
    import org.apache.commons.lang.time.*;
    public class SecondsConversion {
         public static void main(String[] args) {
              try {
                   int seconds = 18084;
                   int milliseconds = seconds * 1000;
                   String[] values = DurationFormatUtils.formatDuration(milliseconds, "H m s").split(" ");
                   System.out.println(values[0] + "h " + values[1] + "m " + values[2] + "s ");
              } catch (Exception e) {
                   e.printStackTrace();
    }

  • 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,'','')

  • 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.

  • 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)

  • Convert Seconds to Hours

    Hi
    I would like to convert seconds to hours -
    I have tried the below two -
    select to_char(to_date(176400,'SSSSS'),'HH:MI:SS') from dual;
    SELECT NUMTODSINTERVAL (176400, 'minute') FROM DUAL;
    Regards

    Hi,
    Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    Simplify the problem as much as possible. Remove all tables and columns that play no role in this problem.
    Always say which version of Oracle you're using.
    If you have a number of seconds (s), you can find the equivalent number of hours (h) if you divide s by the number of seconds in an hour, 60 * 60 = 3600.
    SELECT  s
    ,       s / 3600     AS h
    FROM    table_x
    ;H won't necessarily be an integer. If you want an integer, use a rounding function: ROUND, TRUNC, FLOOR or CEIL

  • 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 seconds to date

    I was working on this query but I was wondering if there was a way to convert seconds to a date. The program records the number of seconds since January 1, 1960.
    SELECT (CLINICALDATE/1000000) "DATE" FROM DOCUMENT WHERE ROWNUM < 6
    DATE                  
    1389799659            
    1406552001            
    1406553986            
    1406553986            
    1406555279            
    5 rows selected

    may be this,
      1   with t as
      2      (select 1389799659  CLINICALDATE from dual
      3              union all
      4         select 1406552001 from dual
      5              union all
      6         select 1406553986 from  dual)
      7   select (CLINICALDATE)/60/60/24 as days, to_date('01-01-1960','dd-mm-yyyy')old_day,
      8   to_date('01-01-1960','dd-mm-yyyy')+ ((CLINICALDATE)/60/60/24) New_day
      9*  from t
    SQL> /
          DAYS OLD_DAY             NEW_DAY
    16085.6442 01-01-1960 00:00:00 15-01-2004 15:27:39
    16279.537 01-01-1960 00:00:00 27-07-2004 12:53:21
      16279.56 01-01-1960 00:00:00 27-07-2004 13:26:26typo
    Message was edited by:
    devmiral

  • 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?

  • Convert Seconds to Hours:Minutes:Seconds

    If I have an integer holding the number of seconds, how can I convert it into a string/relavant format in the form Hours:Minuteseconds?
    For example, 123 seconds should be 00:02:03.
    If it is possible to do the above, then how can I seperate it into 00 Hours indicator, 02 Minutes indicator and 03 Seconds indicator?

    Here are some alternative solutions, there are many more. (VI is LabVIEW 8.2)
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    GetTimeElements.png ‏31 KB
    GetTimeElements.vi ‏11 KB

  • How to Convert frames into minutes and seconds

    Hi,
    does anyone know how to convert frames into time (minutes and
    seconds). I need the users to view the swf with current time being
    played and over time. I have 2152 frames in total and I want that
    to be converted to time. Can anyone help me on this. I would really
    appreciate it. It is very urgent!!!!
    Thanks

    Time Indicator,
    > does anyone know how to convert frames into time
    (minutes
    > and seconds).
    That depends entirely on the framerate of the movie. At the
    default
    12fps, 12 frames would be one second; 24 frames would be two.
    At 24fps, 24
    frames would be one second.
    > I need the users to view the swf with current time being
    played
    > and over time. I have 2152 frames in total and I want
    that to be
    > converted to time. Can anyone help me on this. I would
    really
    > appreciate it. It is very urgent!!!!
    Judging by your four exclamation points, I'd say it's
    definitely urgent!
    Well, again, if you're at 12fps, 2152 frames would take 179
    seconds, or 2
    minutes and 59 seconds. I arrived at that number by dividing
    2152 by 12.
    Keep in mind, though, framerate is actually more of a
    guideline than an
    exact figure. Framerate determines the rate at which Flash
    will *try* to
    display content. On an especially slow computer, the Flash
    Player may not
    be able to keep up, and the same number of frames might
    actually take more
    time.
    David Stiller
    Adobe Community Expert
    Dev blog,
    http://www.quip.net/blog/
    "Luck is the residue of good design."

  • 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 second to hh:mm

    PLEASE, IS THERE A EASILY METHOD TO CONVERT
    A 5 DIGIT NUMBER IN SECOND TO THE FORMAT
    HH:MM (HOUR AND MINUTE)
    THANKS

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Carter:
    This solution is completely wrong.
    For example, if n = 7100, you should get an answer of 1:58 (rounded down to the nearest second). With the above method, you get an answer of 1:97.
    Try select floor(n/3600) | |':'| | round (mod (n, 3600) / 60) from dual;<HR></BLOCKQUOTE>
    Carter is right.In my apps,I use that as what Carter say.It works perfectly.
    null

Maybe you are looking for

  • How to find an external HD

    Hello, my question is, when you eject a external HD from your Mac, how can you get it back if you need it again? Regards Alex

  • IPhoto not registering newly imported photos not in library folders

    I have a 2010 Mac Mini using Lion and iPhoto '11 and a Late 2007 Macbook using Lion and iPhoto '09 that are having similar issues. When I upload new photos into iPhoto the originals (Masters) folder and Modified folder are not being updated with the

  • Can't save in CS5

    Hi all, When I open Cs 4 InDesign documents in CS5, I am not able to save and also the Undo option is disabled. Any ideas?

  • I need help installing the Adobe Reader.

    After I download the Adobe Reader Installer and start the installer it opens a black window and "is not responding." I've tried both versions availabe 11.0 and 10.1

  • How to suppress old version WF for Old notifications

    Hi all, We r using the customised WF for notification QM01.We had created the deadline monitor and send mail to corresponding user by checking the deadline, this is the outstanding message to the user.It was working fine.Now we did the changes in the