Page 1 of 1

Help with time / date

Posted: Wed Dec 03, 2003 12:12 am
by Neo EnD

Code: Select all

$dt = date("Y-m-d H:i:s", time() + ($offset_hours * 60 * 60)) ;
That is the date() function I use to add a date into a database. Now I want to be able to call that date back out, and compare it to another date. Actually, exactly 2 week prior to whatever date is pulled from the database. If the gap between the two is greater than two weeks, I want a message sent to their email.

Question: How do I compare the date pulled from the database, which comes out in this form, 2003-12-03 07:16:16 at a date two weeks prior?

Posted: Wed Dec 03, 2003 12:28 am
by leebo
SELECT * FROM $table WHERE TO_DAYS(NOW()) - TO_DAYS(Column_in_database) =< 14