Good Morning to all,
Today we focus how to calculate number of second saturday,fourth saturday and sunday between two dates.In javascript,it’s very easy to develope this application. But in php, many users have no knowledge regarding this application or this problem.
Here I explain,how to solve this problem: count the number of second saturday, fourth saturday,all sunday between two date using php. Its very simple and easy to understand.
"; $startdate = strtotime("+2 week", $startdate); $total++; } for($j=$from_date;$j<=$to_date;$j+=86400) { if(date('w',($j)) ==0) { $total++; } } echo $total; ?>
First we consider two date and store to variable for develope application like from date and to date. In the above example the fromdate is 2017-08-11 and to date is 2017-09-22. Next we create one variable total for counting number of second,fourth saturday and all sunday betweeen the date. The strtotime is one of the important function in php date.This is used to convert an English textual datetime description to a UNIX timestamp.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.