469,934 Members | 2,667 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

Convert a double to a format of hh:mm:ss

Hi all.

I have written a program that transfers data via FTP. I can calculate
the rough amount of time left. I get a value such as 70.83 seconds
left for instance.

What I want to do is to change this to hh:mm:ss format. Obviously,
VB.NET doesn't seem to want to convert this unless it is already a
DATETIME cast.

Has anyone done this before, or could give me some pointers to
accomplish the conversion.

Thanks,
Robert
Nov 20 '05 #1
2 6670
In article <bd*************************@posting.google.com> ,
rb****@edium.com says...
Hi all.

I have written a program that transfers data via FTP. I can calculate
the rough amount of time left. I get a value such as 70.83 seconds
left for instance.

What I want to do is to change this to hh:mm:ss format. Obviously,
VB.NET doesn't seem to want to convert this unless it is already a
DATETIME cast.

Has anyone done this before, or could give me some pointers to
accomplish the conversion.


Look at the TimeSpan structure. You can use the "FromSeconds" method to
create the structure and then the ToString() method (with a proper
format string) to get the results you'd like.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 20 '05 #2
Fantastic... just what I needed.

I thought there would have been somthing to do it (rather than a
manual coding of it).

It worked exactly how I wanted it,and the structure will help me
replace some code in another project.

Thanks again,
Robert

Patrick Steele [MVP] <pa*****@mvps.org> wrote in message news:<MP************************@msnews.microsoft. com>...
In article <bd*************************@posting.google.com> ,
rb****@edium.com says...
Hi all.

I have written a program that transfers data via FTP. I can calculate
the rough amount of time left. I get a value such as 70.83 seconds
left for instance.

What I want to do is to change this to hh:mm:ss format. Obviously,
VB.NET doesn't seem to want to convert this unless it is already a
DATETIME cast.

Has anyone done this before, or could give me some pointers to
accomplish the conversion.


Look at the TimeSpan structure. You can use the "FromSeconds" method to
create the structure and then the ToString() method (with a proper
format string) to get the results you'd like.

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Krzysztof Skibniewski | last post: by
2 posts views Thread by Thomas Bärwinkel | last post: by
4 posts views Thread by hikums | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.