> I am working on a script for a client of ours and am trying to determine
> how to use the LASTLOGIN field in the external database.  I know the value
> is supposed to be the number of seconds after 1/1/1970 from the archives.
> But when I run this calculation I am coming up around 21 hours off.

I accomplish this by returning out the datetime equivalent of the LASTLOGIN
field from the database rather than the raw number of seconds.  Then you can
compare that to a variable in VBScript that holds the current date and time.

Just select out this value from your database for the user you are
interested in:

CONVERT(datetime, DATEADD(s,LastLogin-21600,'1/1/1970 12:00 AM')) As
LastLogin

Note that LastLogin is in UTC so I subtract 21600 seconds from the LastLogin
field to account for my time zone (CST) which is -6 hours from UTC.

I hope that helps.

- Andy


To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html
List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/

Reply via email to