Skip to content

Instantly share code, notes, and snippets.

@karuppasamy
Created March 8, 2016 03:06
Show Gist options
  • Save karuppasamy/0145336a672d65d3595c to your computer and use it in GitHub Desktop.
Save karuppasamy/0145336a672d65d3595c to your computer and use it in GitHub Desktop.
ruby - number of months between dates
(end_date.year * 12 + end_date.month) - (start_date.year * 12 + start_date.month) + (end_date.day >= start_date.day ? 1 : 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment