Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Decimal Days to X Days, X Min, X, Secs.. already exists?

Status
Not open for further replies.

ChrisCalvert

Technical User
Mar 18, 2002
231
US
I have two date time fields that I am subtracting to get a decimal value, which is days. I am only using this because I cannot average the DateDiff field that I get by using the UFL file that I downloaded from crystal's Website. What I need is the value like Xdays,Xmin,Xsec on each record, and then I need the average of those at the end of each group. I use the DateDiff for each record, but the summary does not offer average, only mean and max,etc. for this field. I have another field that is just the same two datetimes, but with a simple subttraction. I average this field, but that give me a decimal number. What I need is to convert this to a Xdays,Xmin,Xsec format. I want to know if there is anything already out there, or in crystal that does this, as I do not want to have to write this myself, if I could even figure it out. So, does anyone know of something like this?
 
What version of Crystal are you using? Sharing version information about the products you're using will help others to help you.

Create a formula to get the difference in seconds (use datediff), and use the formula I have in the Crystal Formulas FAQ's to display it at the detail level (it does HH:MM:SS, which can easily be adapted to include days also).

Now place another formula containing using the datediff function in seconds itself in the details, right click it and select insert->summary->Average. Now you can remove the field from the details and use the summary function created divided by the number of rows to get the number of seconds average. Again use my formula to convert the display.

-k
 
Thanks, I think that will work just fine.

Also... it's 8.5.



-Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top