CodeIgniter 4: date_default_timezone_set() and the .env timezone don't store the time correctly with the configured timezone
I'm working on a project using CodeIgniter 4, PHP 8.2 and MariaDB 10.11, all running in Docker. The container uses UTC as its default timezone, and I need dates and times to be stored correctly for Guatemala. Since the project is open source, I don't want to hardcode the Guatemala timezone in the code. Instead, I want to read it from a .env variable like this: app.timezone = America/Guatemala First, I tried setting the timezone in CodeIgniter's configuration, in app/Config/Constants.php, like this: date_default_timezone_set(env('app.timezone', 'UTC')); But I got a fatal error saying "undefined
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.