Last active
January 20, 2017 07:00
-
-
Save KeithNdhlovu/54c4cc375b1886148e792119de2c11a4 to your computer and use it in GitHub Desktop.
Laravel Carbon Date DB vs UI
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
<?php | |
// For DB | |
$startDate = Carbon::createFromFormat('d F, Y', $data['start_date'], 'Africa/Johannesburg'); | |
$startDate->setTime($data['start_hour'], $data['start_minute'], 00); | |
$startDate->setTimeZone('UTC'); | |
//For UI | |
$startDate = new Carbon($event->start_date); | |
$startDate->timeZone('Africa/Johannesburg')->format('d-m-Y - H:i:s'), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment