2019-04-22 13:59:04 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Utils\Traits;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class MakesTimezoneAdjustment
|
|
|
|
* @package App\Utils\Traits
|
|
|
|
*/
|
|
|
|
trait MakesTimezoneAdjustment
|
|
|
|
{
|
|
|
|
|
|
|
|
public function createClientDate($utc_date , $timezone)
|
|
|
|
{
|
|
|
|
|
2019-04-22 14:17:52 +02:00
|
|
|
$utc_date->setTimezone(new \DateTimeZone($timezone));
|
2019-04-22 13:59:04 +02:00
|
|
|
|
|
|
|
return $utc_date;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-22 14:17:52 +02:00
|
|
|
public function createUtcDate($client_date)
|
2019-04-22 13:59:04 +02:00
|
|
|
{
|
|
|
|
|
2019-04-22 14:17:52 +02:00
|
|
|
$client_date->setTimezone(new \DateTimeZone('GMT'));
|
2019-04-22 13:59:04 +02:00
|
|
|
|
|
|
|
return $client_date;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|