Created
August 21, 2018 18:24
-
-
Save leonardopinho/af76b9a0606ac7db9125283b716c5ef5 to your computer and use it in GitHub Desktop.
Laravel Utils
This file contains 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
/** | |
* Convert one simple date in Carbon instance object | |
* @param $date | |
* @param string $delimiter | |
* @return Carbon | |
*/ | |
public static function convertToCarbonInstance($date, $delimiter = '-') | |
{ | |
$sp_date = explode($delimiter, $date); | |
return Carbon::parse($sp_date[2] . '-' . $sp_date[1] . '-' . $sp_date[0]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment