943,965 Members | Top Members by Rank

Ad:
Sep 20th, 2007
0

Basic Drop-down date picker

Expand Post »
Dear all,

I would like to implement a simple date picker for my hotel booking website. (No calender required)

Minimum date would be tomorrow's. and maximum would be after 360 days.

The user would have to select the arrival day, month and year each on seperate <select> and then select the number of nights from another <select>

The script should be able to calculate the departure date from the number of nights.

finally the form would pass the arrival and departure dates to my php script using the following format YYYY-MM-DD.


Thanks in advance!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
roy-- is offline Offline
25 posts
since Sep 2007
Sep 21st, 2007
0

Re: Basic Drop-down date picker

Well I have the general Idea to get you started... To calculate the date from the number of nights you need to keep counting the days from the start date.

We know that January has 31 days, February 28 and so on... but February's number of days change according to leap years... So you need some function to check if the year is leap or not (you'll find plenty on the net)...

Keep on counting the days until you hit your new date... That's it...

Let me add that I'm sure there are better solutions (Usually when it comes to dates there could be some Math involved in it and you get a formula to solve your problem).

Good luck
Reputation Points: 14
Solved Threads: 1
Junior Poster in Training
zmariow is offline Offline
69 posts
since Aug 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Getting Permission denied in IE 7 when trying to print from child window
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Need Javascript Help for Display Images





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC