By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,101 Members | 1,416 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,101 IT Pros & Developers. It's quick & easy.

Seconds/Hours/Days etc.. since user last visited

P: n/a
I want to make a table that lists the Seconds / Hours / Days since the user
last visited my site, just like the myPHPnuke systems have, but I dont know
the best way to go about it.

At the moment when the user calls the page the database is updated with the
current date/time for that user.

Should I do this in the VB code in the page or write a SQL statement to do
this?

I have tried in SQL to do this and partly succeeded. Ideally I want it do
display the time in seconds if less than 60 seconds since a visit, minutes
if less than 60 minutes, hours if less than 24 and days if otherwise.

tdi1686

Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Forgot to mention that my DB is Access 2000, so that may restrict the SQL.
"tdi1686" <td*****@coldmail.com> wrote in message
news:O7**************@tk2msftngp13.phx.gbl...
I want to make a table that lists the Seconds / Hours / Days since the user last visited my site, just like the myPHPnuke systems have, but I dont know the best way to go about it.

At the moment when the user calls the page the database is updated with the current date/time for that user.

Should I do this in the VB code in the page or write a SQL statement to do
this?

I have tried in SQL to do this and partly succeeded. Ideally I want it do
display the time in seconds if less than 60 seconds since a visit, minutes
if less than 60 minutes, hours if less than 24 and days if otherwise.

tdi1686

Nov 17 '05 #2

P: n/a
It would really be better in terms of performance to simply get the
TimeStamp from the database raw, and then use code in your app to get the
parts out of it. If you do want to split it up in your SQL, you could do
something like the following:

SELECT Year(someDate) As YearPart, Month(someDate) As MonthPart,
Day(someDate) As DayPart, Hour(someDate) As HourPart,
Minute(SomeDate) As MinutePart, Second(someDate) As SecondPart
FROM someTable

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Neither a follower nor a lender be.

"tdi1686" <td*****@coldmail.com> wrote in message
news:uc**************@TK2MSFTNGP09.phx.gbl...
Forgot to mention that my DB is Access 2000, so that may restrict the SQL.
"tdi1686" <td*****@coldmail.com> wrote in message
news:O7**************@tk2msftngp13.phx.gbl...
I want to make a table that lists the Seconds / Hours / Days since the

user
last visited my site, just like the myPHPnuke systems have, but I dont

know
the best way to go about it.

At the moment when the user calls the page the database is updated with

the
current date/time for that user.

Should I do this in the VB code in the page or write a SQL statement to do this?

I have tried in SQL to do this and partly succeeded. Ideally I want it do display the time in seconds if less than 60 seconds since a visit, minutes if less than 60 minutes, hours if less than 24 and days if otherwise.

tdi1686


Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.