crystal reports Format sum of datediff to DD:HH:MM:SS

Posted on 2006-04-10
Last Modified: 2012-06-21
I need to output a formula field to the format DD:HH:MM:SS.  I am calculationg the datediff of a starttime and endtime and then summing the result.  I separated these out into NumDays, NumHours, NumMins, NumSeconds.  Now I want to string these together in this format DD:HH:MM:SS.   My problem is I keep getting 1 instead of 01 if the value is in single digits.  Example  1: 5: 2:56  for 1 day 5 hours, 2 minutes 56 seconds.
I tried the following but it isnt working
Totext({@NumDays},'##') & ":" &
Totext({@NumHours},'##') & ":" &
Totext({@NumMins},'##') & ":" &
Any ideas?
Question by:tegronakron
    LVL 28

    Accepted Solution

    You are on the right track, except that you need to use '00' instead of '##':

    Totext({@NumDays},'00') & ":" &
    Totext({@NumHours},'00') & ":" &
    Totext({@NumMins},'00') & ":" &

    Author Comment

    Thanks it worked!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    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…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    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…

    758 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

    11 Experts available now in Live!

    Get 1:1 Help Now