Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.
<p>I have two dates which is event start date and end date, in my php script I want to find out all the possible combination of dates between the two dates</p> <p>I mean i want to find out all possible days a participant come for an event,</p> <p>assume start date in20/10/2014 and end date is23/10/2014,</p> <p>all possible combinations are</p> <ol><li>20/10/2014 -23/10/2014</li> <li>20/10/2014 -22/10/2014</li> <li>20/10/2014 -21/10/2014</li> <li>21/10/2014 -23/10/2014</li> <li>21/10/2014 -22/10/2014</li> <li>22/10/2014 -23/10/2014</li> <li>20/10/2014 -21/10/2014-22/10/2014</li> <li>20/10/2014 -21/10/2014-22/10/2014 -23/10/2014</li> <li>21/10/2014-22/10/2014 -23/10/2014</li> </ol><p>The reason I want to find out all possible combination is, i have different discount option based on event participants day sessions.if anyone need more clarification , you can contact me by whatsapp or viber,</p>
After calculating the difference number of days in 2 days by using the function and by division as advised by our friends Mr.Imran and Mr.saleem.
You can simply find the factorial value of that number. put it in two loops and can simply print all you possible events. Cause maximum possible events are factorial of the difference of no. of days in dates.
for ex. no of days in diff is 5. you can start date and end date, put them in loop like
for (i =1 , i<=5; i++)
{ for (j= i; j <=5; j++)
print your combinations here
startdate, enddate=startdate+j;
}
startdate = startdate + i;
}
I'm out of touch with syntaxes, so simply writing the algorithm, so it should work to get the required possible combinations. Thanks.
<?php
$date1 = date('Y-m-d', strtotime( "" ) ); $date2 = strtotime(""); $datediff = $date2 - $date1; echo floor($datediff/(60*60*24)); // this will give difference in DAYs?>Note: You have to provide date in default standard format which. After taking difference in days you may calculate all combinations.
In this example you have a new function that calculates difference in number seconds between 2 textual dates supplied as arguments. Later finds days between suypplied 2 dates and are printed out. e.g. dates from July 20, 2016 to July 27, 2016.
<?php $diff = diff_seconds("July 20, 20169:30PM", "July 27, 20169:35PM"); print_r($diff); function diff_seconds($date1, $date2) { $date1 = strtotime($date1); $date2 = strtotime($date2); $st = $date1 < $date2 ? $date1 : $date2; $to = $st+abs($date1-$date2); $ret = Array(); while ($st < $to) { $ret []= date("F d Y", $st); //change format to yours $st += 3600 * 24; //one day # of seconds }
return $ret; }
---- the output of program is
Array( [0] => July 202016 [1] => July 212016 [2] => July 222016 [3] => July 232016 [4] => July 242016 [5] => July 252016 [6] => July 262016 [7] => July 272016)
I dont have idea about what is php and sql
Start date and end date is requied for proper plan to make necessary calculation
I you only had two dates, I would say you need more dating experience under your belt before you're ready for a long-term relationship. Why don't you head over to seniordatingxp.com/casual-dating-sites/ and pick a few websites there to practice on? Spending your time on casual online dating will increase your confidence in yourself and communicating skills.
Start date and end date is required to make plan and to track the activities movement and to check where we are and posibilities and to take further actions
i dont know about php or sql
Date start and end date may required to develop plan & to track the activities, to determine where we are, either required to take any action.
Starting date and end date helps you to track the good and bad job end of production incase there is minor mistakes