lundi 26 novembre 2018

Configure Laravel TimeZone base on the System TimeZone - Laravel 5

I'm trying

to set the timezone configuration on config/app.php base on my the system time on CentOS VM automatically.

'timezone' => 'America/New_York',

I've tried added these few lines of code on top of config/app.php

// Try #1
// $timeZone = shell_exec("date +\"%Z %z\" | awk '{print $1}'");
// dd($timeZone);  I got "EST\n"

// Try #2
// session_start();
// $timezone = $_SESSION['time'];
// dd($timeZone);

// Try #3
// $timezone = date_default_timezone_get()
// dd($timeZone);

None of these above seem to work.


Questions

How would one go about and debug this further ?


I'm open to any suggestions at this moment.

Any hints/suggestions / helps on this be will be much appreciated!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire