Convert seconds to minutes and seconds

T

tshad

Is there a quick function in vb out there that will convert seconds to
minutes and seconds?

Thanks,

Tom
 
K

Kevin Spencer

How about a couple of operators instead?

seconds \ 60 = minutes
seconds Mod 60 = seconds

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
T

tshad

Kevin Spencer said:
How about a couple of operators instead?

seconds \ 60 = minutes
seconds Mod 60 = seconds

That works fine.

I was just interested to see if there was a function that did it as part of
an object.

Thanks,

Tom
 
K

Kevin Spencer

Yes. You would have to put the values into a DateTime object and use the
..Minutes and .Seconds properties. But my method is more efficient.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
T

tshad

Kevin Spencer said:
Yes. You would have to put the values into a DateTime object and use the
.Minutes and .Seconds properties. But my method is more efficient.

I agree.

Since there isn't much to it (I also put a Cint around the minutes
calculation), there is really no reason to set up a separate object to
handle it.

Thanks,

Tom
 
K

Kevin Spencer

Since there isn't much to it (I also put a Cint around the minutes
calculation), there is really no reason to set up a separate object to
handle it.

No need for a CInt around anything. The VB.Net "\" operator returns an
integer.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
T

tshad

Kevin Spencer said:
No need for a CInt around anything. The VB.Net "\" operator returns an
integer.

I didn't know about that one.

You're right. It works fine that way. I just automatically used "/".

Thanks,

Tom
 

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

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,831
Latest member
HealthSmartketoReviews

Latest Threads

Top