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

counting time values

Status
Not open for further replies.

mbryantuk

Programmer
Aug 3, 2007
29
GB
Hi

I have a long list of time values in the format hh:mm:ss:ms i need to add all of these together and return a cumulative value in the same format how can i do this in crystal?

Thanks

Matt
 
Treat the elements as separate fields, e.g.
Code:
Split({field}, "::")[1]*3600  + 
Split({field}, "::")[2]*60 + 
Split({field}, "::")[3] + 
Split({field}, "::")[4]/ 100
This should yield the number of seconds, which you can then add. You mignt need to do them as ToNumber(Split({field}, "::")[1])

It helps to give your Crystal version - 8, 8.5, 9, 10, 11 or whatever. Methods sometimes change between versions, and higher versions have extra options.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top