Jump to content

Archived

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

warpdesign

Need advice on date input

Recommended Posts

I'm creating an appointment application that the user inputs the dates of events. I created the interface as pull down menus so there are seven pull downs like so:
-Day of week- -Month- -Day- -Year- @ -Hour- : -Min- -AM/PM-

The desired input would be something like Mon, Sep 18 2006 @ 10:30 AM.

So I have a two part question, 1) is there a way to check that the date is valid? For example if the user imputs Tue, Sep 18 2006 and Sep 18 2006 is actually a Monday it should return an error. 2) is there a better way to get date input from the user? Seems like there should be some kind of calendar or something they can click on to ensure that they can't enter an invalid date but I don't want to build something like that from scratch...

Share this post


Link to post
Share on other sites
As long as you have the day, date and year your user does not need to input the actual day. You can echo that information out of php.

I use day-month-year in seperate drop downs, then before inserting you can put it together and insert it into your database as a date.

[code]$date = $year.'-'.$month.'-'.$day;[/code]

Hope this helps, I've never answered anyone's question before.

Share this post


Link to post
Share on other sites
http://www.rainforestnet.com/datetimepicker.htm

That solves many of the problems about choosing non-existent dates and is much 'friendlier' to humans than a multiple set of dropdowns.  Then 'reformat' the input to match whatever you want in the database in the form you want it. Hint: store it as datetime so you can do sensible sorting afterward.

Share this post


Link to post
Share on other sites

×

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.