timestamp
| From: | John Taylor-Johnston | Date: | Fri, 22 Aug 2003 05:23:55 +0000 |
| Subject: | timestamp | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-160391@lists.php.net to get a copy of this message | ||
Not teasing, I know I could do this with some ready made script, but I want to make my own.
I'm making a counter.
CREATE TABLE
counter (
IPAddress VARCHAR NOT NULL ,
RemoteHost VARCHAR NOT NULL ,
TimeStamp TIMESTAMP NOT NULL,
Date VARCHAR NOT NULL
)
Question 1, how do I create a timestamp, (My SQL above does not work.), if this is indeed what I
want to do.
Question 2, how can I read TimeStamp and if the elapsed time between visits is more than 60 minutes,
I insert a new record?
Where do I start?
I can do somethng similar with cookies in Javascript and this is the format, I imagine???, I would
use:
var expdate = new Date();
// Set cookie to expire in 1 hour
// 1000 milliseconds (milliseconds per second)
// * 60 milliseconds (seconds per minute)
// * 60 milliseconds (minutes per hour)
// * 1 milliseconds (hours per day)
// * 1 milliseconds (days)
expdate.setTime (expdate.getTime() + (1000*60*60*1*1));