Skip to content

Instantly share code, notes, and snippets.

@KeithNdhlovu
Last active January 20, 2017 07:00
Show Gist options
  • Save KeithNdhlovu/54c4cc375b1886148e792119de2c11a4 to your computer and use it in GitHub Desktop.
Save KeithNdhlovu/54c4cc375b1886148e792119de2c11a4 to your computer and use it in GitHub Desktop.
Laravel Carbon Date DB vs UI
<?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