help with date variable

Discussion and Questions about PHP.
brianw11
Posts: 5
Joined: Fri Aug 04, 2006 1:21 am

help with date variable

Postby brianw11 » Sun Aug 20, 2006 4:29 pm

I currently have a database of events, which I display using the database component on Fusion 9. When displaying the events to users, I do not want for dates that have already past to be displayed. I currently do this through a set of restrictions on the record set, where only listings with a month greater than or equal to the current month, and a day greater than or equal to the current day, are displayed. However, the current day and current month are not automated. Every day I have to go in and edit the restriction on the database and change the conditions...ex "where day is greater or equal to 18" would be the restritcion on the 18th of the month, and on the 19th, I have to change the 18 to a 19. Is there anyway for me to embedd a variable on my page which automatically obtains the current date, so that I can just resctrict the record set by that variable? I hope that makes sense. Thanks.

Brian

User avatar
admin
Site Admin
Posts: 1303
Joined: Mon Oct 24, 2005 2:07 am
Location: Stuart, FL
Contact:

Re: help with date variable

Postby admin » Sun Aug 20, 2006 8:46 pm

I currently have a database of events, which I display using the database component on Fusion 9. When displaying the events to users, I do not want for dates that have already past to be displayed. I currently do this through a set of restrictions on the record set, where only listings with a month greater than or equal to the current month, and a day greater than or equal to the current day, are displayed. However, the current day and current month are not automated. Every day I have to go in and edit the restriction on the database and change the conditions...ex "where day is greater or equal to 18" would be the restritcion on the 18th of the month, and on the 19th, I have to change the 18 to a 19. Is there anyway for me to embedd a variable on my page which automatically obtains the current date, so that I can just resctrict the record set by that variable? I hope that makes sense. Thanks.

Brian
Working with dates can be interesting.

You can use the PHP date function to find the current date and then grab the part of the resulting array you need to do your work.

But when you're talking about comparing dates, you get into the "what if" game. What if it's the end of the month? Or end of a year?

Can you give me a URL to look at to see what you're doing with the manual date change you're doing now?

Admin Chuck

brianw11
Posts: 5
Joined: Fri Aug 04, 2006 1:21 am

dates

Postby brianw11 » Sun Aug 20, 2006 9:11 pm

Chuck,
The url for the site is www.classifiedu.net

You can see the events on the front page. When users submit an event, a seperate number is stored for the day, the month, and the year. The recordset is currently setup so that it only displays records where the month is greater or equal than 8, the day is greater than equal than 20 and the year is equal to 2006. Tommorrow I will log in and change it so the day must be greater than or equal to 21, the next day 22, and so on. The records are then displayed in ascending order, first by month, and then by day. This does a fine job of excluding events that have past and displaying events in order from soonest to furthest away. It's just rather inconvenient, so we need a way to change the 8 to the "current month" and to change the 20 to the "current day". Thanks again.

Brian


Return to “PHP Q&A”

Who is online

Users browsing this forum: No registered users and 1 guest

cron