senty senty - 1 year ago 177
PHP Question

Carbon difference two dates in weeks

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?

Answer Source

There is a function in Carbon called diffInWeeks()

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download