Created
January 7, 2023 08:40
-
-
Save aldhinya/3ee2612eb37ff7c98311dd5a99f55250 to your computer and use it in GitHub Desktop.
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
$tanggal = $this->transformDate($i[2])->toDateString(); | |
public function transformDate($value, $format = 'Y-m-d') | |
{ | |
try { | |
return \Carbon\Carbon::instance(\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($value)); | |
} catch (\ErrorException $e) { | |
return \Carbon\Carbon::createFromFormat($format, $value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment