Convert a second value into hours mintues and seconds

Posted on 2006-03-23
Last Modified: 2012-06-22
What i need to achive :

There is a value that is stored in the database ( call_req.time_spent_sum) this has a value in seconds

I need this value to be given as hours:mintues:seconds
so if call_req.time_spent_sum = 4830
i need to get 1:20:30
this is got by
3600 + 1200 +30

now after getting this value

i also have to get the sum of the amount of hr:min:sec spent on solving a particular problem in that day .

there are a few functions i have come across

such as

Ive tried these but I am unsuccessful in getting the solution.

Please advice
Question by:picasothakkar
    LVL 28

    Accepted Solution

    Try this formula:

    local numbervar total_secs := {call_req.time_spent_sum};
    local numbervar hrs := int(total_secs / 3600);
    local numbervar mins := int(remainder(total_secs,3600)/60);
    local numbervar secs := remainder(remainder(total_secs,3600),60);

    totext(hrs,0,"") & ":" & totext(mins,0,"") & ":" & totext(secs,0,"")
    LVL 16

    Expert Comment

    I would suggest that in the CR you summarize your seconds before you display them with the above formula.  This way you are able to acheive both results in multiple areas.  
    LVL 6

    Expert Comment

    by:Ken Turner
    If you need to convert seconds to a proper time field (as opposed to a string field as described above), all you need is:

    LVL 28

    Expert Comment


    I agree that will work, just with the caveat that when the number of seconds are >= 86400, then you will not see the elapsed correct time.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
    I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    26 Experts available now in Live!

    Get 1:1 Help Now