Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

carbon months between dates

$to = CarbonCarbon::createFromFormat('Y-m-d H:s:i', '2015-5-5 3:30:34');
$from = CarbonCarbon::createFromFormat('Y-m-d H:s:i', '2016-6-6 9:30:34');
$diff_in_months = $to->diffInMonths($from);
print_r($diff_in_months); // Output: 1
 
PREVIOUS NEXT
Tagged: #carbon #months #dates
ADD COMMENT
Topic
Name
4+6 =