how to get a finishing date

Help with installation and general calendar setttings

how to get a finishing date

Postby amit » Thu May 20, 2010 8:39 am

hello sir,

As i mentioned earlier i am making a booking site....So i need to get the finishing date for a particular booking (booked till some date) how to get date..
Somewhere in the forum you told that it can be achieved by adding no. of nights to the starting date.
Bt hw to add no. of nights to a date dont knw.. ;(
Actually i am able to add no. of days to current date ...by using strtotime() function ..bt hw to add if i use some future date in place of current date..??
Please help me sir.. :idea: :idea: :idea:


One more thing i want to ask that how to create a popup window with the information availability and price when a user clicks on a particular date.like this page.
http://www.resavenue.com/booking/bookingWizard.res

Thank you sir.


Regards
amit
amit
 
Posts: 8
Joined: Wed May 19, 2010 11:35 am

Re: how to get a finishing date

Postby chris » Thu May 20, 2010 9:39 am

Somewhere in the forum you told that it can be achieved by adding no. of nights to the starting date.
Bt hw to add no. of nights to a date dont knw.. ;(

hmmm... date+num nights?
Of course you need to take into account the end of the month and year.
This is pretty basic php date stuff, just google somethinge like "php add days to given date" - that gave me over 5million results, the second one of which was this: http://www.vision.to/how-to-add-days-we ... -date-.php which pretty much sums it up with the following code snippet:
Code: Select all
$date = date("Y-m-d");// current date

$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 day");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 week");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +2 week");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 month");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +30 days");


Actually i am able to add no. of days to current date ...by using strtotime() function ..bt hw to add if i use some future date in place of current date..??

The actual start date is irrelevant, just pass the date correctly formatted.
One more thing i want to ask that how to create a popup window with the information availability and price when a user clicks on a particular date.like this page.
http://www.resavenue.com/booking/bookingW

That link doesn't work for me but the problem here is not the popup window (pretty basic javascript stuff) but getting the prices for the dates. You would have to extend the availability calendar to be able to store prices for every date, for date periods or for weekdays (according to your specific needs)
This goes well beyond the scope of this script which is simply designed to show availability.
A may one day provide a (paid) extension to do this but it is not an immediate priority I'm afraid.

Chris
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain

Re: how to get a finishing date

Postby amit » Thu May 20, 2010 11:09 am

Thanks sir ,

I got the answer for my first ques ... :idea: :D :)
Code: Select all
<?php
$date=$_GET['date']; //selected date from the calendar
$x=$_GET['x'];    // No. of nights to be added
echo date('Y-m-d', strtotime("$date + $x days")); // finishing date
?>



Thank you once again.


regards
amit :mrgreen:
amit
 
Posts: 8
Joined: Wed May 19, 2010 11:35 am


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron