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

Approach v.9 - Help with Formula

Status
Not open for further replies.

galewis

Programmer
May 5, 2002
2
0
0
GB
Hello everyone,

I am a novice developer in need of assistance. I need a formula to covert decimal hours and minutes into real (analogue?) hours and minutes. For example 2.5 hours should read 2:30 minutes, and 1.75 hours should read 1:45. If anyone knows how to do this, I'd really appreciate it if you'd let me know.
 
Example: 2.5 hours in field named DHR

Assuming you might have no hours, but something like DHR = .5, you need to check for these things! Some calculated fields would do this for you:

DP = Position(DHR,'.',1)
Hours = If(DP < 1,DHR,If(DP = 1,0,Left(DHR,DP - 1)))
DecMin = If(DP < 1,0,Right(DHR,Length(DHR) - DP)))
AnaMin = Trunc(60 * DecMin)
AnaSec = (60 * DecMin) - AnaMin

CalcTime = Time(Hours,AnaMin,AnaSec)

Sue Sloan
XpertSS.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top