Dynamic Date Dropdown

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
cjt3007
Forum Newbie
Posts: 1
Joined: Tue Aug 31, 2010 9:00 pm

Dynamic Date Dropdown

Post by cjt3007 »

Okay, so I have a timestamp database. In this database are stored multiple checkin dates for each user. I would like to know how I would make a script that determines whether the checkin is this year or a previous year. Afterwhich I make a dropdown menu that shows the different years a user can select to view the timestamps from that year.

Note: These are SCHOOL YEARS so they can have two different actual numerical years within one academic year. Each school year on July 1 at 12 AM and end on June 30 at 11:59 PM.
sammonster
Forum Newbie
Posts: 6
Joined: Tue Aug 31, 2010 10:51 pm

Re: Dynamic Date Dropdown

Post by sammonster »

You could use MySQL's Date functions to search for a specific year, month, day, or time. You could also update your field to be an INT, store a unix timestamp, and then just have php give you a mktime range and do a select based off that range.

After that, it's a simple matter of Javascript and HTML to pretty up your results.
Post Reply