time conversion

Discussion in 'ASP General' started by Andrew, Jan 2, 2004.

  1. Andrew

    Andrew Guest

    Hi,
    How can I convert seconds to hh:mm:ss format? e.g. 123456s = 34:17:36
    Thanks
    --
    Andrew
    Andrew, Jan 2, 2004
    #1
    1. Advertising

  2. Andrew

    Evertjan. Guest

    Andrew wrote on 02 jan 2004 in microsoft.public.inetserver.asp.general:

    > How can I convert seconds to hh:mm:ss format? e.g. 123456s = 34:17:36
    >


    <http://groups.google.com/groups?selm=7i6qdp%24d0j%241%40news1.xs4all.nl>

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Jan 2, 2004
    #2
    1. Advertising

  3. Andrew

    Steven Burn Guest

    Look into the Format function;

    e.g.: Response.Write Format(Time(), "hhmmss")

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    Disclaimer:
    I know I'm probably wrong, I just like taking part ;o)


    Andrew <> wrote in message
    news:XChJb.267613$ea%...
    > Hi,
    > How can I convert seconds to hh:mm:ss format? e.g. 123456s = 34:17:36
    > Thanks
    > --
    > Andrew
    >
    >
    >
    Steven Burn, Jan 2, 2004
    #3
  4. Andrew

    Evertjan. Guest

    Evertjan. wrote on 02 jan 2004 in microsoft.public.inetserver.asp.general:

    > Andrew wrote on 02 jan 2004 in microsoft.public.inetserver.asp.general:
    >
    >> How can I convert seconds to hh:mm:ss format? e.g. 123456s = 34:17:36
    >>

    >
    > <http://groups.google.com/groups?selm=7i6qdp%24d0j%241%40news1.xs4all.nl>


    Or more recent:
    <http://groups.google.com/groups?
    selm=Xns944B7A0BC6853eejj99%40194.109.133.29>


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Jan 2, 2004
    #4
  5. Andrew

    Foo Man Chew Guest

    Format() is not available in ASP.

    For alternatives, see these articles:
    http://www.aspfaq.com/show.asp?id=2271
    http://www.aspfaq.com/show.asp?id=2313





    "Steven Burn" <nobody@PVT_it-mate.co.uk> wrote in message
    news:...
    > Look into the Format function;
    >
    > e.g.: Response.Write Format(Time(), "hhmmss")
    >
    > --
    > Regards
    >
    > Steven Burn
    > Ur I.T. Mate Group
    > www.it-mate.co.uk
    >
    > Keeping it FREE!
    >
    > Disclaimer:
    > I know I'm probably wrong, I just like taking part ;o)
    >
    >
    > Andrew <> wrote in message
    > news:XChJb.267613$ea%...
    > > Hi,
    > > How can I convert seconds to hh:mm:ss format? e.g. 123456s = 34:17:36
    > > Thanks
    > > --
    > > Andrew
    > >
    > >
    > >

    >
    >
    Foo Man Chew, Jan 2, 2004
    #5
  6. Andrew

    Andrew Guest

    Got it, thanks

    --
    Andrew


    "Evertjan." <> wrote in message
    news:Xns9464B9F9D2465eejj99@194.109.133.29...
    > Andrew wrote on 02 jan 2004 in microsoft.public.inetserver.asp.general:
    >
    > > How can I convert seconds to hh:mm:ss format? e.g. 123456s = 34:17:36
    > >

    >
    > <http://groups.google.com/groups?selm=7i6qdp%24d0j%241%40news1.xs4all.nl>
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)
    Andrew, Jan 2, 2004
    #6
  7. Andrew

    Steven Burn Guest

    I've got it working just fine in one of my scripts. (working alongside FSO)

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    Disclaimer:
    I know I'm probably wrong, I just like taking part ;o)


    Foo Man Chew <> wrote in message
    news:#...
    > Format() is not available in ASP.
    >
    > For alternatives, see these articles:
    > http://www.aspfaq.com/show.asp?id=2271
    > http://www.aspfaq.com/show.asp?id=2313
    >
    >
    >
    >
    >
    > "Steven Burn" <nobody@PVT_it-mate.co.uk> wrote in message
    > news:...
    > > Look into the Format function;
    > >
    > > e.g.: Response.Write Format(Time(), "hhmmss")
    > >
    > > --
    > > Regards
    > >
    > > Steven Burn
    > > Ur I.T. Mate Group
    > > www.it-mate.co.uk
    > >
    > > Keeping it FREE!
    > >
    > > Disclaimer:
    > > I know I'm probably wrong, I just like taking part ;o)
    > >
    > >
    > > Andrew <> wrote in message
    > > news:XChJb.267613$ea%...
    > > > Hi,
    > > > How can I convert seconds to hh:mm:ss format? e.g. 123456s = 34:17:36
    > > > Thanks
    > > > --
    > > > Andrew
    > > >
    > > >
    > > >

    > >
    > >

    >
    >
    Steven Burn, Jan 2, 2004
    #7
  8. "Andrew" wrote:
    >
    > How can I convert seconds to hh:mm:ss format?
    > e.g. 123456s = 34:17:36


    Number.prototype.pad = function(d) {
    var val = String(this)
    d = Math.max(d,val.length)
    for (var i=0; i<d; i++) val = "0" + val
    return val.substring(val.length-d)
    }

    var seconds = 123456,
    hh = Math.floor(seconds/3600),
    mm = Math.floor(seconds%3600/60),
    ss = seconds%60

    return hh.pad(2) + ":" + mm.pad(2) + ":" + ss.pad(2)

    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms. Please do not contact
    me directly or ask me to contact you directly for assistance. If your
    question is worth asking, it's worth posting.
    Dave Anderson, Jan 2, 2004
    #8
  9. Andrew

    Bob Barrows Guest

    Uummm, this is vbscript, not vb/vba. No builtin Format() function in
    vbscript.

    Besides, this will not convert an integer containing a number of seconds to
    a string in hh:mm:ss format.

    Steven Burn wrote:
    > Look into the Format function;
    >
    > e.g.: Response.Write Format(Time(), "hhmmss")
    >
    >
    > Andrew <> wrote in message
    > news:XChJb.267613$ea%...
    >> Hi,
    >> How can I convert seconds to hh:mm:ss format? e.g. 123456s = 34:17:36
    >> Thanks
    >> --
    >> Andrew


    Bob Barrows

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows, Jan 2, 2004
    #9
  10. > I've got it working just fine in one of my scripts. (working alongside
    FSO)

    Format is VB / VBA, not VBScript. So the only way you could have it working
    is if you had a custom format() function, like the one in one of foo's
    links.
    freaky friday, Jan 2, 2004
    #10
    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. engsol
    Replies:
    2
    Views:
    933
    Dan Bishop
    Jan 26, 2004
  2. Replies:
    8
    Views:
    462
    Magnus Lycka
    Aug 5, 2005
  3. Peter Hansen
    Replies:
    0
    Views:
    707
    Peter Hansen
    Feb 22, 2006
  4. flamesrock
    Replies:
    8
    Views:
    438
    Hendrik van Rooyen
    Nov 24, 2006
  5. Replies:
    2
    Views:
    501
Loading...

Share This Page