paddy_fields Posted December 5, 2010 Share Posted December 5, 2010 Hi there. I'm trying to create my own search function for users to search for events between certain dates. One option I have is 'within next 7 days'. So, within the SQL function I am searching "... WHERE eventdate between $from and $to.." The $from variable I figured would be $from = date('d-m-Y',time()); (ie- todays date)... but how would I find the date in 7 days?. I've seen strtotime mentioned about the web but can't figure how this applies. Any help would be marvelous! Cheers, Paddyfields. Quote Link to comment https://forums.phpfreaks.com/topic/220754-date-headache/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 5, 2010 Share Posted December 5, 2010 If your eventdate column was a mysql DATE data type (YYYY-MM-DD), you could do this directly in the query, because dates in that format can be directly compared and you can use the numerous mysql date/time functions on it to form a date x days in the future to compare with. Quote Link to comment https://forums.phpfreaks.com/topic/220754-date-headache/#findComment-1143320 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.