Last active
February 17, 2017 19:52
-
-
Save dillinghamio/692b847ebd281e4a1c6c7ec9ec3b986d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$originalStartDate = app('Carbon\Carbon')->parse('1/30/2017'); | |
$newStartDate = app('Carbon\Carbon')->parse('2/27/2017'); | |
$difference = $originalStartDate->diffInDays($newStartDate); | |
$dates = [ | |
'2/20/2017', | |
'2/24/2017', | |
'3/6/2017', | |
'3/27/2017', | |
'4/3/2017', | |
'4/10/2017', | |
]; | |
foreach($dates as $key => $date) | |
{ | |
$dates[$key]['original'] = app('Carbon\Carbon')->parse($date); | |
$dates[$key]['new'] = app('Carbon\Carbon')->parse($date)->addDays($difference); | |
} | |
foreach($dates as $key => $date) | |
{ | |
echo "original: " . $date['original']->format('l m/d/Y') . "<br>"; | |
echo "new: " . $date['new']->format('l m/d/Y') . "<br>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment