Convert seconds to minutes and seconds

Discussion in 'ASP .Net' started by tshad, Mar 11, 2005.

  1. tshad

    tshad Guest

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

    Thanks,

    Tom
     
    tshad, Mar 11, 2005
    #1
    1. Advertising

  2. 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.

    "tshad" <> wrote in message
    news:usT$...
    > Is there a quick function in vb out there that will convert seconds to
    > minutes and seconds?
    >
    > Thanks,
    >
    > Tom
    >
     
    Kevin Spencer, Mar 11, 2005
    #2
    1. Advertising

  3. tshad

    Karl Seguin Guest

    Or

    dim t as new TimeSpan(0,0,135)

    t.Minutes
    t.Seconds

    Karl


    --
    MY ASP.Net tutorials
    http://www.openmymind.net/ - New and Improved (yes, the popup is
    annoying)
    http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
    come!)
    "Kevin Spencer" <> wrote in message
    news:...
    > 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.
    >
    > "tshad" <> wrote in message
    > news:usT$...
    > > Is there a quick function in vb out there that will convert seconds to
    > > minutes and seconds?
    > >
    > > Thanks,
    > >
    > > Tom
    > >

    >
    >
     
    Karl Seguin, Mar 11, 2005
    #3
  4. tshad

    tshad Guest

    "Kevin Spencer" <> wrote in message
    news:...
    > 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
    >
    > --
    > HTH,
    >
    > Kevin Spencer
    > Microsoft MVP
    > .Net Developer
    > What You Seek Is What You Get.
    >
    > "tshad" <> wrote in message
    > news:usT$...
    >> Is there a quick function in vb out there that will convert seconds to
    >> minutes and seconds?
    >>
    >> Thanks,
    >>
    >> Tom
    >>

    >
    >
     
    tshad, Mar 11, 2005
    #4
  5. 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.

    "tshad" <> wrote in message
    news:%...
    > "Kevin Spencer" <> wrote in message
    > news:...
    >> 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
    >>
    >> --
    >> HTH,
    >>
    >> Kevin Spencer
    >> Microsoft MVP
    >> .Net Developer
    >> What You Seek Is What You Get.
    >>
    >> "tshad" <> wrote in message
    >> news:usT$...
    >>> Is there a quick function in vb out there that will convert seconds to
    >>> minutes and seconds?
    >>>
    >>> Thanks,
    >>>
    >>> Tom
    >>>

    >>
    >>

    >
    >
     
    Kevin Spencer, Mar 11, 2005
    #5
  6. tshad

    tshad Guest

    "Kevin Spencer" <> wrote in message
    news:...
    > 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
    >
    > --
    > HTH,
    >
    > Kevin Spencer
    > Microsoft MVP
    > .Net Developer
    > What You Seek Is What You Get.
    >
    > "tshad" <> wrote in message
    > news:%...
    >> "Kevin Spencer" <> wrote in message
    >> news:...
    >>> 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
    >>>
    >>> --
    >>> HTH,
    >>>
    >>> Kevin Spencer
    >>> Microsoft MVP
    >>> .Net Developer
    >>> What You Seek Is What You Get.
    >>>
    >>> "tshad" <> wrote in message
    >>> news:usT$...
    >>>> Is there a quick function in vb out there that will convert seconds to
    >>>> minutes and seconds?
    >>>>
    >>>> Thanks,
    >>>>
    >>>> Tom
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    tshad, Mar 11, 2005
    #6
  7. > 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.

    "tshad" <> wrote in message
    news:...
    > "Kevin Spencer" <> wrote in message
    > news:...
    >> 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
    >>
    >> --
    >> HTH,
    >>
    >> Kevin Spencer
    >> Microsoft MVP
    >> .Net Developer
    >> What You Seek Is What You Get.
    >>
    >> "tshad" <> wrote in message
    >> news:%...
    >>> "Kevin Spencer" <> wrote in message
    >>> news:...
    >>>> 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
    >>>>
    >>>> --
    >>>> HTH,
    >>>>
    >>>> Kevin Spencer
    >>>> Microsoft MVP
    >>>> .Net Developer
    >>>> What You Seek Is What You Get.
    >>>>
    >>>> "tshad" <> wrote in message
    >>>> news:usT$...
    >>>>> Is there a quick function in vb out there that will convert seconds to
    >>>>> minutes and seconds?
    >>>>>
    >>>>> Thanks,
    >>>>>
    >>>>> Tom
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Kevin Spencer, Mar 11, 2005
    #7
  8. tshad

    tshad Guest

    "Kevin Spencer" <> wrote in message
    news:%23%...
    >> 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.


    I didn't know about that one.

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

    Thanks,

    Tom
    >
    > --
    > HTH,
    >
    > Kevin Spencer
    > Microsoft MVP
    > .Net Developer
    > What You Seek Is What You Get.
    >
    > "tshad" <> wrote in message
    > news:...
    >> "Kevin Spencer" <> wrote in message
    >> news:...
    >>> 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
    >>>
    >>> --
    >>> HTH,
    >>>
    >>> Kevin Spencer
    >>> Microsoft MVP
    >>> .Net Developer
    >>> What You Seek Is What You Get.
    >>>
    >>> "tshad" <> wrote in message
    >>> news:%...
    >>>> "Kevin Spencer" <> wrote in message
    >>>> news:...
    >>>>> 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
    >>>>>
    >>>>> --
    >>>>> HTH,
    >>>>>
    >>>>> Kevin Spencer
    >>>>> Microsoft MVP
    >>>>> .Net Developer
    >>>>> What You Seek Is What You Get.
    >>>>>
    >>>>> "tshad" <> wrote in message
    >>>>> news:usT$...
    >>>>>> Is there a quick function in vb out there that will convert seconds
    >>>>>> to minutes and seconds?
    >>>>>>
    >>>>>> Thanks,
    >>>>>>
    >>>>>> Tom
    >>>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    tshad, Mar 11, 2005
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. 00_CP_D12
    Replies:
    3
    Views:
    9,054
    dilipv
    Feb 22, 2008
  2. Stu
    Replies:
    7
    Views:
    1,825
    Dave Thompson
    Mar 7, 2005
  3. `p
    Replies:
    7
    Views:
    409
    Steve Litt
    Dec 14, 2005
  4. Replies:
    1
    Views:
    577
    Roedy Green
    Aug 13, 2012
  5. lemonhead71
    Replies:
    0
    Views:
    1,723
    lemonhead71
    Oct 3, 2012
Loading...

Share This Page