Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
helper
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 date_format
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Traits;
4
5use App\Models\Setting;
6use DateTime;
7use DateTimeZone;
8
9trait helper
10{
11    public static function date_format($date){
12        $newDate = new DateTime($date, new DateTimeZone(env('TIMEZONE', 'Africa/Cairo')) ); //in defoult timezone
13        $newDate->setTimeZone(new DateTimeZone(getTimeZone())); // in setting time_zone
14
15        return $newDate->format(getDateFormat());
16    }
17}