In my web app, I let the users choose their preferred timezone from a list (that contains all timezones that PHP supports).
Let’s say that $_POST['timezone'] is the chosen timezone (e.g. America/New_York).
I set it with the following code which produces no errors:
default_date_timezone_set($_POST['timezone']);
But when I reload the page it goes back to what it was before (e.g. Europe/Moscow).
Do I have to set the default timezone in every script or isn’t the function (default_date_timezone_set) working properly?
Thanks!
This function changes the timezone for the execution of the script only.
You could store the timezone in a session variable and set the time zone on top of every page.