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; }