Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Carbon difference two dates in weeks [duplicate]

I have a date in this format: '2017-09-26 00:02:37'. I am trying to calculate the difference of this date and now, and get the value in months. Eg. (52 weeks)

What is the proper way of achieving this?

like image 777
senty Avatar asked May 18 '26 09:05

senty


1 Answers

There is a function in Carbon called diffInWeeks()

$date->diffInWeeks($otherDate);
like image 185
Jeff Avatar answered May 20 '26 23:05

Jeff



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!