Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Subtract one datetime from another

Reply
Thread Tools

Subtract one datetime from another

 
 
Simon Gare
Guest
Posts: n/a
 
      06-19-2006
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


 
Reply With Quote
 
 
 
 
Aaron Bertrand [SQL Server MVP]
Guest
Posts: n/a
 
      06-19-2006
Take a look at DateDiff()




"Simon Gare" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
Kyle Peterson
Guest
Posts: n/a
 
      06-19-2006

http://www.powerasp.com/content/new/...ference-19.htm

"Simon Gare" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: [2.4.4] creating a datetime.datetime from an XML xs:dateTime skip@pobox.com Python 2 01-06-2009 01:31 PM
[2.4.4] creating a datetime.datetime from an XML xs:dateTime Martin Python 0 12-27-2008 08:08 PM
mx.DateTime to datetime.datetime mp Python 1 07-28-2006 10:57 PM
datetime: .datetime-.datetime = .timedelta, .time-.time=TypeError ? Christos TZOTZIOY Georgiou Python 3 09-13-2003 10:44 AM
RE: datetime: .datetime-.datetime = .timedelta, .time-.time=TypeError ? Tim Peters Python 0 09-09-2003 12:57 AM



Advertisments