Last active
April 3, 2020 02:11
-
-
Save ryzr/6203299fadef949805ae to your computer and use it in GitHub Desktop.
Fix null/empty -0001-11-30 00:00:00 dates
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
use Carbon\Carbon; | |
public function getCreatedAtAttribute($value) | |
{ | |
//fixes 0000-00-00 00:00:00 date to return 1970-01-01 09:30:00 instead of -0001-11-30 00:00:00 | |
return Carbon::createFromTimeStamp($value)->toDateTimeString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment