display a range of DATES

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
miramichiphoto
Forum Newbie
Posts: 14
Joined: Thu Mar 17, 2011 1:12 pm

display a range of DATES

Post by miramichiphoto »

Fellow coders;

I want to display a schedule, but only between certain dates. The events get scheduled by users, using a php calendar function that inserts dates into the db that look like this: 2100-12-27. The db column type is "date".

My question is how would I display events sorted by date, with a range of 1 week before today's date to one week after today's date? (I have been looking at examples online, but MAN it is confusing.)

Cheers.

L
fugix
Forum Contributor
Posts: 207
Joined: Fri Mar 18, 2011 8:01 pm

Re: display a range of DATES

Post by fugix »

I would imagine that you would use a timestamp incorporated into yor MYSQL query function WHERE $date < time()+seconds AND $date > time()-seconds...something like that
Post Reply