Set the default timezone in symfony
Solution 1
The symfony way is to use default_timezone
in settings.yml. See this for more details.
Solution 2
For one, you may consider setting it in your php.ini
. If you're on a shared server, that's not a viable option, but the common place to set project-global properties is the config/ProjectConfiguration.php
, just after plugin setup.
Firouziam
AMir Firouzi, a freelance web developer, familiar with php, Symfony, Asp.Net, C#, Android Programming And...
Updated on June 04, 2022Comments
-
Firouziam almost 2 years
i want to know how can i set timezone for an entire project?
i'm using symfony 1.4 with doctrine and i have a problem with datetime saving.
whenever i save a record, it's time is not correct and i know that's because of timezone.i know i can use
date_default_timezone_set()
function to set default timezone, but i have to do it in every single action that i'm using date and it's not right.is there an easier way to do it? i think doctrine should have something to set it automatically but i don't know how.
-
Firouziam over 12 yearsyeah. that's way better. i was looking for something exactly like this.thanks
-
Vlad Jula-Nedelcu about 7 yearsWhy down vote? You should at least write a reason if you believe this is not the right way.