in reply to calculating 24 hours ago with localtime

Maybe it's just me, but I find this question extremely difficult to understand. Let me attempt to paraphrase:

If the above assumptions are correct, then I wouldn't bother messing around with localtime. I'd just do it with the sql. Not sure which db you are using, but with mysql the following would suffice:

DELETE FROM time_now WHERE time < (NOW() - INTERVAL 5 MINUTE); DELETE FROM day_now WHERE time < (NOW() - INTERVAL 1 DAY);

Apologies if I've misunderstood your question. If that's the case, perhaps you could clarify a bit.

Replies are listed 'Best First'.
Re^2: calculating 24 hours ago with localtime
by Anonymous Monk on Dec 09, 2005 at 08:07 UTC
    using NOW(), how would I setup the database then? Right now I am using time VARCHAR(25) for the time field and I am inserting the $localtime as a string.

    Yes, this is MySQL and you are right. Two tables. One for the last 5 minutes. One for the last 24 hours.

      using NOW(), how would I setup the database then? Right now I am using time VARCHAR(25) for the time field and I am inserting the $localtime as a string.

      When you create your database table, use a datetime data type for your time field.

      The mysql NOW() function returns the current date/time, so you simply use this for both your INSERTs and DELETEs

      Cheers,
      Darren :)