By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,524 Members | 1,589 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,524 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.