Best Jquery ,javascript, HTML5 CSS3 tutorial with jquery examples, php script , demos for beginners, web designers and web developers.

Jquery

Jquery Training

Jquery training blog

Find dates of a particular day between two dates in php

Find dates of a perticular day between two dates in php Suppose you want to find all modays between two dates, i mean if you want to find the all the mandays between 12-10-2017 and 29-11-2017 you can use the following function. Declare the variables start date end date and day number. $startDate=’12-10-2017′; $endDate=’29-11-2017′; $dayNumber=2; Continue Reading


Find dates of a perticular day between two dates in php

Suppose you want to find all modays between two dates, i mean if you want to find the all the mandays between 12-10-2017 and 29-11-2017

you can use the following function.

Declare the variables start date end date and day number.

$startDate='12-10-2017';
$endDate='29-11-2017';
$dayNumber=2;

call the function getDays

print_r(getDays($startDate,$endDate,$dayNumber));

Define the function getDays

function getDays($startDate,$endDate,$dayNumber){
$endDate = strtotime($endDate);
$days=array(
'1'=>'Monday',
'2' => 'Tuesday',
'3' => 'Wednesday',
'4'=>'Thursday',
'5' =>'Friday',
'6' => 'Saturday',
'7'=>'Sunday'
);
for($i = strtotime($days[$dayNumber], strtotime($startDate)); $i <= $endDate; $i = strtotime('+1 week', $i))
$date_array[]=date('Y-m-d',$i);

return $date_array;
}
Please follow and like us:






About the author

Joydeb Choudhury holds a Master's degree in Computer Application from I.G.N.O.U. After working as a web developer in various companies he has started bloging in 2016.

Recent Posts of blog

Downalod Free Php Scripts