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

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

  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. 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. Christos TZOTZIOY Georgiou
    Replies:
    3
    Views:
    767
    Christos TZOTZIOY Georgiou
    Sep 13, 2003
  2. Tim Peters
    Replies:
    0
    Views:
    605
    Tim Peters
    Sep 9, 2003
  3. mp
    Replies:
    1
    Views:
    445
    John Machin
    Jul 28, 2006
  4. Martin
    Replies:
    0
    Views:
    379
    Martin
    Dec 27, 2008
  5. Replies:
    2
    Views:
    806
    M.-A. Lemburg
    Jan 6, 2009
Loading...

Share This Page