473,473 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 6920
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Krzysztof Skibniewski | last post by:
Hello, I'm trying find out how to obtain and output that format ( hh:mm:ss.fff ) in my ASP. if somebody knows, pls let me know.. thx kris
2
by: Thomas Bärwinkel | last post by:
Hallo, ich würde gerne zwei Zeitangaben im Format hh:mm:ss addieren. z.B.: 00:01:50 + 01:02:12 = 01:03:02 gibt es in PHP Funktionen mit denen ich Zeiten in diesem Format addieren kann? ...
4
by: hikums | last post by:
Does anyone have a function to convert duration in seconds to a format hh:mm:ss Thanks.
2
by: D. Shane Fowlkes | last post by:
Here's a good one. I've been using an Excel spreadsheet for the past couple of years to calculate a file's Estimated Download Time based off of a solid 50kbs connection (dial up). This is for a...
14
by: Michael Barrido | last post by:
I have this for example: Dim iSeconds as int32 = 3600 '3600 seconds is one hour How do i convert it to "01:00:00" ? Please help. Thanks in advance!
5
nirmalsingh
by: nirmalsingh | last post by:
i am getting date format in string as 30-11-2006 05:59:44 PM . i want to convert in the format of yyyy-mm-dd hh:mm:ss to sore it in mysql database. Help me with sample coding plz..
1
seshu
by: seshu | last post by:
Hi every body to morning my cousine has show his application and also his live db in that to sav the length of all the voice files he has saved in time format ie he took the datatype of time now i...
1
seshu
by: seshu | last post by:
Hi every body to morning my cousine has show his application and also his live db in that to sav the length of all the voice files he has saved in time format ie he took the datatype of time now i...
5
by: sudip77 | last post by:
Hi, I have an user input variable called @stop_time which takes input in the format of HH:MM:SS. I need to convert it into seconds only. How can I do that? Can anyone help please?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.