Jnerocorp Posted November 2, 2009 Share Posted November 2, 2009 Hello, Is it possible for php/mysql to check if the timestamp in a row/table is older than 7 days the timestamp looks like this: 2009-11-01 20:05:18 in table "tokens" -John Quote Link to comment https://forums.phpfreaks.com/topic/179897-solved-phpmysql-check-if-timestamp-2009-11-01-200518-is-more-than-7-days-old/ Share on other sites More sharing options...
taquitosensei Posted November 2, 2009 Share Posted November 2, 2009 this should do it if($timestamp < date("Y-m-d H:i:s",strtotime("-7 Days"))); { } Quote Link to comment https://forums.phpfreaks.com/topic/179897-solved-phpmysql-check-if-timestamp-2009-11-01-200518-is-more-than-7-days-old/#findComment-949007 Share on other sites More sharing options...
MadTechie Posted November 2, 2009 Share Posted November 2, 2009 or MySQL SELECT *,DATE_ADD(TimeStampField, INTERVAL 7 DAYS) > NOW() as Over7Days FROM tokens if($row['Over7Days']){ echo "Over 7 days"; } Quote Link to comment https://forums.phpfreaks.com/topic/179897-solved-phpmysql-check-if-timestamp-2009-11-01-200518-is-more-than-7-days-old/#findComment-949047 Share on other sites More sharing options...
Jnerocorp Posted November 2, 2009 Author Share Posted November 2, 2009 thanks guys Quote Link to comment https://forums.phpfreaks.com/topic/179897-solved-phpmysql-check-if-timestamp-2009-11-01-200518-is-more-than-7-days-old/#findComment-949055 Share on other sites More sharing options...
MadTechie Posted November 2, 2009 Share Posted November 2, 2009 Solved ? if so please click topic solved! Quote Link to comment https://forums.phpfreaks.com/topic/179897-solved-phpmysql-check-if-timestamp-2009-11-01-200518-is-more-than-7-days-old/#findComment-949061 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.