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

Using formulas

Status
Not open for further replies.

Olii

Programmer
Sep 22, 2000
13
CA
Hi everyone !!

I'm new with Crystal but I want to use more of its feature and functions...

I want to convert a string to a time value but the string is a sum of time values converted to a string later (ex: sum(thread.time)) so I have totals like --> 45:23 that means 4523 minutes so I did this little .prg to convert it ..:

messagebox("ten:"+cur_final.som_ten)
tr = padl(alltrim(cur_final.som_ten),5,"0")
min_tot = (val(substr(tr,1,1))*1000+val(substr(tr,2,1))*100+val(substr(tr,4,1))*10+val(substr(tr,5,1)))/60
tmp_minute = min_tot * 100
tmp_s = padl(alltrim(str(tmp_minute)),5,"0")
totalm = substr(alltrim(tmp_s),1,3)
fin = (val(substr(tr,1,1))*1000+val(substr(tr,2,1))*100+val(substr(tr,4,1))*10+val(substr(tr,5,1)))-(val(totalm)*60)
final = totalm + '.' + alltrim(str(fin))
replace ten with final

but I'm pretty sure that there's something in crystal that does this...what is it ?

something that can give me 01:40 if I give 1:00 (100 minutes) in the first place...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top