PC Review


Reply
Thread Tools Rate Thread

Convert Seconds to Days, Hours and Seconds foramt.

 
 
WRACK
Guest
Posts: n/a
 
      7th Sep 2003
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.


 
Reply With Quote
 
 
 
 
Armin Zingler
Guest
Posts: n/a
 
      7th Sep 2003
"WRACK" <(E-Mail Removed)> 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

 
Reply With Quote
 
Fergus Cooney
Guest
Posts: n/a
 
      7th Sep 2003
Hi Herfried,

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

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

Regards,
Fergus


 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      7th Sep 2003
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


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      8th Sep 2003
Hello,

"Fergus Cooney" <filter-(E-Mail Removed)> 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


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      8th Sep 2003
Hello,

"Cor" <(E-Mail Removed)> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
convert seconds to hours and days Ranjith Kurian Microsoft Excel Worksheet Functions 3 6th May 2009 06:21 PM
Convert seconds to days, hours, minutes and seconds. Sheldon Microsoft VB .NET 5 6th Jul 2008 03:09 PM
i need to convert seconds (ie: 17288.35111) into days, hours, min =?Utf-8?B?anJpZWNoZXJz?= Microsoft Excel Misc 1 27th Sep 2005 10:06 PM
How to convert Seconds to X Hours Y Minutes Z Seconds? 00_CP_D12 Microsoft ASP .NET 2 5th Apr 2005 10:27 PM
convert seconds into days, hours and minutes ty Microsoft Access 1 6th Jan 2004 08:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:14 AM.