|
Home > Archive > IIS ASP > June 2006 > Subtract one datetime from another
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Subtract one datetime from another
|
|
| Simon Gare 2006-06-19, 7:22 pm |
| 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] 2006-06-19, 7:22 pm |
| Take a look at DateDiff()
"Simon Gare" <sg@simongare.com> wrote in message
news:%23K8xiM9kGHA.2304@TK2MSFTNGP02.phx.gbl...
> 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 2006-06-19, 7:22 pm |
|
http://www.powerasp.com/content/new...eference-19.htm
"Simon Gare" <sg@simongare.com> wrote in message
news:%23K8xiM9kGHA.2304@TK2MSFTNGP02.phx.gbl...
> 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
>
>
|
|
|
|
|