Solved

Convert Decimal Number to HH:MM:SS

Posted on 2006-07-14
3
5,035 Views
Last Modified: 2008-09-03
Hello Experts:
We have a FireBird DB from which we're using CR XI to pull a decimal number that represents hours spent on a project.

I'd like to convert this decimal number to appear in my reports in the format of:  "HH:MM:SS" (without any reference to AM/PM, as that is irrelevant)

But I will also need to summarize the column that holds these times into the same format, thus performing math on the converted numbers. (without conversion to days at HH > 24.)

Examples:
Decimal Hours= Desired result
0.03 = 00:01:48
2.25 = 02:15:00

Summarized as:
02:16:48

I'm sure I can work out the math, multiplying the initial decimal by 3600 for total SS, and working my way from there to MM and HH, but am wondering if there is a shorter method within CR XI.

TIA!


 
0
Comment
Question by:boris711
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 17

Expert Comment

by:MIKE
ID: 17111635
CR has a function called TIME(number)
the number can be decimal
Use a forumla to convert the field(type number) to type time
Then use the fomula where ever required.

ex: 2.83 converts to  7:55:12PM
    18.87 converts to  8:52:48PM


You might use CTime because you can only use Time in Crystal syntax as it is a type name in Basic syntax.

CTime (number) converts the given number to a Time value; the given number is in units of 24 hours, can be fractional or negative as well.

Hope it helps
MikeV
0
 
LVL 6

Accepted Solution

by:
Ken Turner earned 250 total points
ID: 17111756
Conversion of the detail items is easy: TimeValue ({YourHours}/24).

Assuming you accuimulate a total of {YourHours}, conversion of the total is a bit more tricky because of the HH > 24 situation; the following formula converts the accumulated hours into a string in the format hh:mm:ss:

Totext({YourHours},0,'') + ':' + totext(timevalue({YourHours} / 24),'mm:ss')
0
 
LVL 1

Author Comment

by:boris711
ID: 17218710
While neither comment hit exactly what I was looking for KenTurner's gave me a new perspective. Thank you both for responding.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

763 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