The program works fine when I pass the array like following:
$holidays=array("2015-01-01","2015-01-05","2015-01-10");
echo getWorkingDays("2015-01-02","2015-01-09",$holidays);
But when I extract the data from database like this:
$holidays = DB::table('tbl_holiday')->select('holiday_date')->whereBetween('holiday_date', array('2015-01-01', '2015-01-20'))->get();
I am getting this error: strtotime() expects parameter 1 to be string, object given
In my helpers.php, I have this code
foreach($holidays as $holiday){
$time_stamp=strtotime($holiday);
//If the holiday doesn't fall in weekend
if ($startDate <= $time_stamp && $time_stamp <= $endDate && date("N",$time_stamp) != 6 )
$workingDays--;
}
Any help would be appreciated.