Convert both to unix much easier to wrok with both date and time then


From: "Ron Piggott (PHP)" <[EMAIL PROTECTED]>
To: PHP DB <>
Subject: [PHP-DB] SELECT
Date: Fri, 20 Jan 2006 06:00:33 -0500

Yesterday I asked how to get the date & time 90 minutes ago and I
received several responses.  Thanks.

I don't think this select statement is working "correctly".  (Correctly
being what I am intending it to do)

I took a look at the table this morning.  One record remains that was
created 2006-01-19 at 23:55:37.  These are the values of date_created
and time_created.  The current values are approximately 2006-01-20 and

This is the select statement I am writing about:

SELECT * FROM `table` WHERE `date_created` <= '$date_90_minutes_ago' AND
`time_created` <= '$time_90_minutes_ago'

Intellectually I know the problem: 05:50:00 is much earlier than
23:55:37 ... thus my AND is not allowing both conditions to exist

Is there a way that I may modify this SELECT statement so the present
conditions continue to exist and add a second part to the SELECT
statement that if the time is 01:30:00 or higher that records from the
previous day are selected?  This continues to allow the 90 minute time
frame for users logged into my web site ... I am not sure how you would
add an OR function to the above without messing up what presently
works :)

(I am writing a SESSION function for my web site using mySQL and a cron.
The select statement I quoted above is part of the cron.)


PHP Database Mailing List (
To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to