[AccessD] A2K: Time diff calcs

A.D.Tejpal adtp at touchtelindia.net
Tue Sep 14 13:36:16 CDT 2004


Darren,

    The select query given below should get you the period lapsed in terms of DaysGap (if more than 24 hrs) and TimeGap (over & above the completed days).

    T_Log is the name of data table.

Regards,
A.D.Tejpal

=================================
SELECT T_Log.LogonTimeAndDate, Int(Now()-[LogonTimeAndDate]) AS DaysGap, Format((Now()-[LogonTimeAndDate]),"hh:nn:ss") AS TimeGap
FROM T_Log;
=================================

  ----- Original Message ----- 
  From: Darren DICK 
  To: AccessD List 
  Sent: Tuesday, September 14, 2004 17:54
  Subject: [AccessD] A2K: Time diff calcs


  Hello all
  I want to calculate then insert into a table the duration of a users logon
  in HOURS and MINUTES
  In the logon table the default value for the logon field is Now() and is
  captured at...You guessed at logon. I then run a query that updates the
  Logoff field to Now() once the user answers YES to loggin off. The theory
  being there will be a difference even if it is only 5 or 10 seconds. Unless
  some clown plays with the clock after loggin on --- but forget all that :-))

  Both logon and logoff fields data types in the Logon Table are General Date
  (01/01/2004 15:45:25PM)

  So a user logs on at say...14/09/2004 10:08:45 PM and then logs off at
  say...14/09/2004 10:10:55 PM

  The time logged on = 2 mins and 10 secs but how do I calculate that?

  I have udsed DateDiff but with no success...
  DateDiff("Short Time",[LogonTimeAndDate],Now())
  DateDiff("mm",[LogonTimeAndDate],Now())
  DateDiff("nn",[LogonTimeAndDate],Now()) etc etc

  Many thanks in advance

  Darren




More information about the AccessD mailing list