Call to a member function diff() on null – Count days between dates

i need to create a counter between dates

Controller:

$registro = Registro::where('fechaviso', $request->id)->first();
    $fechaaviso = $registro->fechaviso;
    $fechahoy = new DateTime();
    $contadorfecha = $fechaaviso->diff($fechahoy);

I need to count the days that pass between the date of the variable: $fechaviso, to today.

error: Call to a member function diff() on null

help pls



Read more here: https://stackoverflow.com/questions/68466352/call-to-a-member-function-diff-on-null-count-days-between-dates

Content Attribution

This content was originally published by user13523236 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: