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

Time Conversion - decimal minutes to readable minutes 4

Status
Not open for further replies.

ahaws

Programmer
Nov 28, 2001
355
US
Hi guys. I have another question regarding time conversion.

I have a dbf that contains seconds. I was asked to convert those figures to minutes, but now the minutes show up as
for example:

3650 seconds = 60.84 minutes

I would like to show the 60.84 minutes as 60 minutes and 50 seconds. Is there an easy way to do this?

Also, when figuing something like 580 minutes
580/60 = 9.6666 hours

(conversion of the .6666 hours)

If any help, all is appreciated! thanks
Angie
 
? int(3650/60) produces 60
? 3650%60 produces 50


Attitude is Everything
 
ahaws

rgbean posted this a while ago.

Code:
? ss2hhmmss(3650) && That's yours

? ss2hhmmss(3662)
? ss2hhmmss(7262)
? ss2hhmmss(7342)


FUNCTION SS2HHMMSS
LPARAMETERS p_nSeconds
LOCAL l_nHours, l_nMinutes, l_nSeconds
l_nHours = INT(p_nSeconds / 3600)
l_nMinutes = INT((p_nSeconds - 3600*l_nHours) / 60)
l_nSeconds = MOD(p_nSeconds, 60)
RETURN ALLTRIM(TRANSFORM(l_nHours, "9999"));
  + ":"+TRANSFORM(l_nMinutes, "@L 99");
  + ":"+TRANSFORM(l_nSeconds, "@L 99")
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
HI

myTIme = 3650

? STR(FLOOR(myTime/3600),2)+":" + ;
STR(FLOOR(MOD(myTime,3600)/60),2)+":"+ ;
STR(MOD(myTime,60),2)

If it is more than a day.. suitably expand..

Hope this helps you :) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
try this function. i hope this helps. :)

function myTime
parameter anytime
local anyhrs, anymin, anysec
anyhrs = int(anytime / 3600)
anymin = int((anytime % 3600) / 60)
anysec = int((anytime % 3600) % 60)

return thr + ' hour' + iif(val(thr) <> 1, 's', '') + ', ' +;
tmn + ' minute' + iif(val(tmn) <> 1, 's', '') + ', ' +;
tsc + ' second' + iif(val(tsc) <> 1, 's', '') + '.'


torturedmind [trooper]
 
sorry... thr, tmn and tsc should read anyhrs, anymin and anysec respectively.

sometimes i get stupified :)

torturedmind [trooper]
 
Thanks for ALL your help guys!
Have a great afternoon!
Angie
 
One more question. I have data that is represented in a grid. inside the grid, the values be converted from decimal time to readable minutes. The grid is built from a view. Is there some way to convert at runtime? Let me know! Thanks
Angie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top