Subtract one datetime from another

Discussion in 'ASP General' started by Simon Gare, Jun 19, 2006.

  1. Simon Gare

    Simon Gare Guest

    Hi all,

    need to subtract one date from another to show how long a user was logger in
    for.

    i.e.

    <%=(rsDriverLogin.Fields.Item("OFF_DATE").Value)%> minus
    <%=(rsDriverLogin.Fields.Item("ON_DATE").Value)%>

    The values in the sql OFF_DATE and ON_DATE fields are stored as

    13/06/2006 19:01:28

    Can either be done on the ASP page or in the db itself, doesn't matter
    which.

    Regards
    Simon
     
    Simon Gare, Jun 19, 2006
    #1
    1. Advertisements

  2. Take a look at DateDiff()




    "Simon Gare" <> wrote in message
    news:%...
    > Hi all,
    >
    > need to subtract one date from another to show how long a user was logger
    > in
    > for.
    >
    > i.e.
    >
    > <%=(rsDriverLogin.Fields.Item("OFF_DATE").Value)%> minus
    > <%=(rsDriverLogin.Fields.Item("ON_DATE").Value)%>
    >
    > The values in the sql OFF_DATE and ON_DATE fields are stored as
    >
    > 13/06/2006 19:01:28
    >
    > Can either be done on the ASP page or in the db itself, doesn't matter
    > which.
    >
    > Regards
    > Simon
    >
    >
     
    Aaron Bertrand [SQL Server MVP], Jun 19, 2006
    #2
    1. Advertisements

  3. http://www.powerasp.com/content/new/function-reference-19.htm

    "Simon Gare" <> wrote in message
    news:%...
    > Hi all,
    >
    > need to subtract one date from another to show how long a user was logger
    > in
    > for.
    >
    > i.e.
    >
    > <%=(rsDriverLogin.Fields.Item("OFF_DATE").Value)%> minus
    > <%=(rsDriverLogin.Fields.Item("ON_DATE").Value)%>
    >
    > The values in the sql OFF_DATE and ON_DATE fields are stored as
    >
    > 13/06/2006 19:01:28
    >
    > Can either be done on the ASP page or in the db itself, doesn't matter
    > which.
    >
    > Regards
    > Simon
    >
    >
     
    Kyle Peterson, Jun 20, 2006
    #3
    1. Advertisements

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. loveNUNO
    Replies:
    2
    Views:
    1,217
    loveNUNO
    Nov 20, 2003
  2. Christos TZOTZIOY Georgiou
    Replies:
    3
    Views:
    1,048
    Christos TZOTZIOY Georgiou
    Sep 13, 2003
  3. mp
    Replies:
    1
    Views:
    680
    John Machin
    Jul 28, 2006
  4. Martin
    Replies:
    0
    Views:
    644
    Martin
    Dec 27, 2008
  5. Replies:
    2
    Views:
    1,063
    M.-A. Lemburg
    Jan 6, 2009
  6. NiklasRTZ

    datetime.datetime. or datetime. ?

    NiklasRTZ, Oct 8, 2009, in forum: Python
    Replies:
    10
    Views:
    760
    niklasr
    Oct 11, 2009
  7. Robert Cohen
    Replies:
    3
    Views:
    595
    Andrew Durstewitz
    Jul 15, 2003
  8. Justin Voelker
    Replies:
    2
    Views:
    479
    Dr J R Stockton
    Dec 2, 2008
Loading...