Are you trying to track how long someone has stayed on your website (multiple pages), or are you trying to see how long someone viewed a single page on your website before moving on to another page?
If it's the former, a possible solution would be to start a session when someone first visits your website, and from then on in that session, when they visit another page on your website update a timestamp in your database.
3 fields in your table:
sessionid
starttime
endtime
New session:
insert new row with starttime of NOW()
Existing session:
update existing row with endtime of NOW().
You'll end up with rows showing how long each user stayed (or at least how long between the time they requested their first page and the time they requested their last page)
This won't be much help if it's the latter.