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

Convert time elapsed count into format 00:00:00

Status
Not open for further replies.

sony2000

Programmer
Dec 7, 2003
34
HK
Hi,

Does anyone know any function can convert a time elapsed
count in seconds into a format hh:mm:ss?
For example, 62 seconds ---> 00:01:02.

Please help! Thanks for your kind attention,
Raymond Lee
 
Use a TimeSpan object, and then when you go to display it, use ToString() method (no formatting string is required, as it's native format is [ignore][-][d.]hh:mm:ss[.ff][/ignore]
Code:
Dim ts as TimeSpan
ts = TimeSpan.FromSeconds(62)
Console.WriteLine(ts.ToString())
Chip H.

____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Thanks JohnYingling and chiph.
Your both are very helpful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top