473,473 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Convert Seconds to Days, Hours and Seconds foramt.

Hi,

I am trying to make a function which accepts Seconds as an argument and
returns them into Days, Hours & Seconds format and can't seem to make it
working.

Can someone please help me to make this function. I am quite new to VB.NET
however I have been using VB 6 from 1 year now.

Cheers.
Nov 20 '05 #1
5 14936
"WRACK" <nc******@123india.com> schrieb
I am trying to make a function which accepts Seconds as an argument
and returns them into Days, Hours & Seconds format and can't seem to
make it working.

Can someone please help me to make this function. I am quite new to
VB.NET however I have been using VB 6 from 1 year now.


Dim ts As New TimeSpan(0, 0, 123456)
MsgBox(ts.ToString)
If you don't like the format, you must build the string on your own using
the TimeSpan's properties and the String.Format function.
--
Armin

Nov 20 '05 #2
Hi Herfried,

|| TimeSpan(123456 * 10 ^ 7) ' 100 ns unit!

LOL. I don't know why. It's just funny! :-)

Regards,
Fergus
Nov 20 '05 #3
Cor
Fergus,
Maybe because Armin did not put his famous sentence.
It has to be something like
Dim ts As New TimeSpan(CLng(123456 * 10 ^ 7)) ' 100 ns unit!
:-)
It is for Armin, not for Jack.
Cor
Nov 20 '05 #4
Hello,

"Fergus Cooney" <fi******@tesco.net> schrieb:
|| TimeSpan(123456 * 10 ^ 7) ' 100 ns unit!

LOL. I don't know why. It's just funny! :-)


I know that there are other ways, but that's one way to create a
'TimeSpan' object representing 123456 seconds.

--
Herfried K. Wagner
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet
Nov 20 '05 #5
Hello,

"Cor" <no*@non.com> schrieb:
Maybe because Armin did not put his famous sentence.
;-)
It has to be something like
Dim ts As New TimeSpan(CLng(123456 * 10 ^ 7)) ' 100 ns unit!


No, there is no need to add 'CLng' with 'Option Strict Off'.

;-)

--
Herfried K. Wagner
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet
Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: NotGiven | last post by:
Below is a good elapsed time function I found. However, I'd like to return total seconds instead of broken down into days, hours, minutes & seconds. In other words, I want "125" instead of "2...
2
by: Rudi Groenewald | last post by:
Hi all. If I've got a query which has a field with seconds in it... how will I use the Convert function to get my field converted to the format: HH:MM:SS ? The field with the seconds in is...
2
by: tdi1686 | last post by:
I want to make a table that lists the Seconds / Hours / Days since the user last visited my site, just like the myPHPnuke systems have, but I dont know the best way to go about it. At the moment...
2
by: 00_CP_D12 | last post by:
Is there an easy way in ASP.NET to convert seconds to Hours: Minutes: Seconds? For example, 65 seconds will return 0 hr, 1 min, 5 secs. Thanks...
29
by: Jan | last post by:
Hi: I have an Access database that's been running (in one form or another) for a couple of different clients for a few years. Now a new client has requested that it be implemented with a SQL...
7
by: WorldIsEnding | last post by:
Hey, Im having trouble with converting a Numeric value (such as a single digit number like 1 or 5) into a time format. I need to convert a number entered into a variable into Hours on the...
6
by: alexs | last post by:
hi, I'm moving a mysql database over to using db2 V9.5 The database is used by our radius server to store network accounting information from our switches. One parameter is the length of a...
5
by: =?Utf-8?B?U2hlbGRvbg==?= | last post by:
Hello - I have about ten integer values that each need to be converted to days, hours, minutes and seconds. I can't seem to find a formula for same that works. These integer values come from a...
3
by: =?Utf-8?B?U2hlbGRvbg==?= | last post by:
Hello - I have various times formatted like 00:00:00, so for example, 01:32:05 would be one thirty-two with five milliseconds. I need to convert this into seconds (an integer). First of...
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: 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.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.