Help with time / date

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Neo EnD
Forum Newbie
Posts: 7
Joined: Sat Nov 22, 2003 7:39 pm

Help with time / date

Post 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?
leebo
Forum Commoner
Posts: 44
Joined: Sun Oct 20, 2002 9:49 am

Post by leebo »

SELECT * FROM $table WHERE TO_DAYS(NOW()) - TO_DAYS(Column_in_database) =< 14
Post Reply