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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help Needed in Converting a number to a Date 1

Status
Not open for further replies.

proflola

IS-IT--Management
Jul 29, 2000
62
US
Hi All,

I'm trying to convert a duration which is in a number format to a date format that contains the following:

# Days, HH:MM

Below is what I'm using now and it converts the hours and minutes, but I can't figure out how to include the days.

Here are two examples of my current conversion:

Duration Duration in hours and minutes
125.57 5:34
2.25 2:15

You can see my problem.

Note: The duration is the result of formula that takes the start time minus the end time (basically).

I hope this makes sense and you have some ideas on it. This is such a great forum! I feel as if I have mentors helping me.

Thanks!
Sandy
 
Your first example doesn't really make sense. From your second example, I would have assumed the first value should have been 300.57. What does the 125.57 represent?

-LB
 
I have a feeling that my conversion formula is the culprit.

Below is my conversion formula. Remember, I only know enough to get myself into trouble. Thank god, you're all here to straighten me out.

Local Numbervar TotalSec := {@duration} ;

Local NumberVar Hours := Truncate (Remainder ( TotalSec,3600) / 60);
Local NumberVar Minutes := Remainder ( TotalSec , 60);

Totext ( Hours, '00', 0,'') + ':'+
Totext ( Minutes,'00', 0,'')

Below is the duration formula using a HEAT built-in function that looks to a work calendar.

HFWDurNumHoursHelpdesk ({CallLog.RecvdDate},{CallLog.RecvdTime},{CallLog.ClosedDate},{CallLog.ClosedTime})
 
Please explain what the 125.57 represents--is it meant to be hours? e.g., 125 and 57/100 hours? In other words, what does {@duration} return? Seconds, hours, what?

-LB
 
I think that your formula returns the hours, bsaed on the name.

So change your formula to:

Local Numbervar TotalSec := {@duration}*60 ;
Local NumberVar Hours := Truncate(Truncate(TotalSec/60)/60);
Local NumberVar Minutes := Remainder(Truncate(TotalSec/60),60);
Totext ( Hours, '00', 0,'') + ':'+
Totext ( Minutes,'00', 0,'')

-k
 
Thank you for such a quick response. You made my Friday! :) Synapsevampire, your solution worked perfectly! Lbass, I'm sorry that I wasn't clear enough. Chock it up to my inexperience.

I've provided software consulting services for years, but find Crystal Reports humbling.

Thanks again!

--Sandy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top