My date looks like this: 28/01/2022
.
I'd like to find out difference in years,months,days from now()
time.
I tried:
1) Not working, because it says my date is illegal format.
\Carbon\Carbon::now()->diffInYears(\Carbon\Carbon::parse($date))
2) This gives me huge number. something like 878 when it should be just 24.
$dateObject = \Carbon\Carbon::createFromFormat('d/m/Y', $date);
return \Carbon\Carbon::now()->diffInDays($dateObject);
Any ideas you can help me?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2ZGDyCN
via IFTTT
Aucun commentaire:
Enregistrer un commentaire