lundi 30 décembre 2019

Carbon date Difference method giving wrong date difference in Laravel 5.7 [closed]

I am getting wrong Date difference between two dates using Carbon in Laravel 5.7.

here this image is showing you Date of sdate value and edate value

enter image description here

my code is

$date = Carbon::parse($sdate);
$now = Carbon::parse($eDate);
$diff = $date->diffInDays($now);
  return ["sdate"=>$sdate,
          "eDate"=>$eDate,
          "total" => $diff, 
          "holidays" => $holidayDayCount,
          "classes" => $diff - count($leaveDayArr),'sunday'=>$sundayArr ,'offDate'=>$offDay
        ];

After this I am getting in API response.

enter image description here

it is showing me 29 but it should be 30.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire