2

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?

Machavity
  • 30,841
  • 27
  • 92
  • 100
senty
  • 12,385
  • 28
  • 130
  • 260

1 Answers1

19

There is a function in Carbon called diffInWeeks()

$date->diffInWeeks($otherDate);
Jeff
  • 24,623
  • 4
  • 69
  • 78