Jump to content

date headache.


paddy_fields

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.