Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/220754-date-headache/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/220754-date-headache/#findComment-1143320
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.