Convert Seconds to Days, Hours and Seconds foramt.

  • Thread starter Thread starter WRACK
  • Start date Start date
W

WRACK

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.
 
WRACK said:
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.
 
Hi Herfried,

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

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

Regards,
Fergus
 
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
 
Hello,

Fergus Cooney said:
|| 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.
 
Hello,

Cor said:
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'.

;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top