DateDiff

Discussion in 'ASP General' started by Jay, Aug 26, 2004.

  1. Jay

    Jay Guest

    I am trying to replicate the Ebay Time Left on Auction.

    1 Day, 1 hour, 12 minutes.

    I would like to calculate this from the current time and date. How do I get
    this result?

    Thanks for the help.
     
    Jay, Aug 26, 2004
    #1
    1. Advertising

  2. Jay

    Raymond Guest

    Here is one way to do this:

    Dim fDate, d, h, m
    fDate = CDate("2004-08-28")
    m = DateDiff("n",now(),fDate)
    h = m\60
    d = h\24
    m = m - (60*h)
    h = h - (24*d)
    Response.Write(d&" days "&h& " hours "&m&" minutes")
    Response.End()

    --

    Raymond Yap

    "Jay" <> wrote in message
    news:fsdXc.3473$...
    > I am trying to replicate the Ebay Time Left on Auction.
    >
    > 1 Day, 1 hour, 12 minutes.
    >
    > I would like to calculate this from the current time and date. How do I

    get
    > this result?
    >
    > Thanks for the help.
    >
    >
     
    Raymond, Aug 26, 2004
    #2
    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. Mark Fox

    DateDiff in C#

    Mark Fox, Jul 16, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    12,902
    Kevin Spencer
    Jul 16, 2003
  2. DateDiff

    , Dec 29, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    467
    Jim in Arizona
    Dec 29, 2006
  3. CJM
    Replies:
    4
    Views:
    209
  4. Tim::.

    Datediff Problem

    Tim::., May 3, 2004, in forum: ASP General
    Replies:
    1
    Views:
    123
    Maarten
    May 3, 2004
  5. Drago

    Datediff good question

    Drago, Jun 5, 2004, in forum: ASP General
    Replies:
    7
    Views:
    129
    Drago
    Jun 8, 2004
Loading...

Share This Page