Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $carbon = new CarbonCarbon($dateasstring);
- $local = $carbon->timezone($localTimeZone);
- // example from artisan tinker:
- [1] > $utc = new CarbonCarbon('2014-01-05 12:00:00');
- // object(CarbonCarbon)(
- // 'date' => '2014-01-05 12:00:00',
- // 'timezone_type' => 3,
- // 'timezone' => 'UTC'
- // )
- [2] > $warsaw = $utc->timezone('Europe/Warsaw');
- // object(CarbonCarbon)(
- // 'date' => '2014-01-05 13:00:00',
- // 'timezone_type' => 3,
- // 'timezone' => 'Europe/Warsaw'
- // )
- private function totimezone($utc){
- $usertz = Session::get('timezone');
- $carbon = new Carbon($utc, 'UTC');
- $carbon->timezone = new DateTimeZone($usertz);
- return $carbon;
- }
- private function toutc($local){
- $usertz = Session::get('timezone');
- $carbon = new Carbon($local, $usertz);
- $carbon->timezone = new DateTimeZone('UTC');
- return $carbon;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement