| | |
Basic Drop-down date picker
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Sep 2007
Posts: 25
Reputation:
Solved Threads: 0
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!
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!
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
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
![]() |
Similar Threads
- Date Field in MySQL with PHP /add/edit/delete (PHP)
- Pls Help Me in Crystal Report 7 (Visual Basic 4 / 5 / 6)
- need help (VB.NET)
- help urgent dtp picker control (Visual Basic 4 / 5 / 6)
- Free BASIC Tool (Legacy and Other Languages)
- Good Luck w/This one: Excel Question VBA/Macro/other (MS Access and FileMaker Pro)
- MS Visual++ 6.0 - Error C2146, C2501 ... (C++)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Getting Permission denied in IE 7 when trying to print from child window
- Next Thread: Need Javascript Help for Display Images
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug calendar captchaformproblem checkbox child close column createrange() css cursor decimal dependent design disablefirebug dom download dropdown editor element embed engine error events explorer ext file form forms google gwt gxt hiddenvalue highlightedword hint html htmlform ie8 iframe images index internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jump libcurl listbox math media microsoft mimic mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php player post problem progressbar regex runtime scroll search security select shopping size software sql text textarea unicode w3c web website window windowofwords windowsxp wysiwyg \n





