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!

Convert numerical value to time value

Status
Not open for further replies.

paulpeyton

Technical User
May 25, 2003
10
US
I have fields that contain a figure in seconds. I then divide that by 3600 to get hours, but I may get 2.75 hours. How do I convert the .75 to read .45 (minutes)?
This issue is throwing off other calculations in my reports. Any assistance will be greatly appreciated.
 
Thanks for the response. The issue is everything before the decimal. If I have 2.75, simply multiplying by 60 results in 165. How do I convert just the decimal without touching the hour?
 
The following formula converts 1.75 to 1.45 using IdoMillet's suggestion:

Truncate(1.75) + (60 * (Remainder(1.75 * 100,100) / 10000))

Replace the "1.75" with your data field.

best of luck
 
Assuming {@seconds} contains the number of seconds, this should work:
-------------------------------------------------------
ToText((Truncate({@seconds}/3600)),0) + " Hours and " +
ToText(60*Remainder({@seconds},3600),0) + " Seconds"
-------------------------------------------------------

hth,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
You guys are great! Thanks so much for the help! Works great!
 
That should have been "Minutes", not "Seconds" at the end of the formula... :eek:)


CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top