User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 456,500 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,682 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 2617 | Replies: 1
Reply
Join Date: Sep 2007
Posts: 25
Reputation: roy-- is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
roy-- roy-- is offline Offline
Light Poster

Help Basic Drop-down date picker

  #1  
Sep 20th, 2007
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!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2007
Posts: 70
Reputation: zmariow is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
zmariow's Avatar
zmariow zmariow is offline Offline
Junior Poster in Training

Re: Basic Drop-down date picker

  #2  
Sep 21st, 2007
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
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 3:31 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC