In my code I set the MySQL timezone to US/Pacific, that results in:
Array ( [0] => SYSTEM [@@global.time_zone] => SYSTEM [1] => US/Pacific [@@session.time_zone] => US/Pacific )
However when I run the query multiple time it sometimes changes, eg
Array ( [0] => SYSTEM [@@global.time_zone] => SYSTEM [1] => US/Arizona [@@session.time_zone] => US/Arizona )
Then sometimes even though I have set it I see this when I query
Array ( [0] => SYSTEM [@@global.time_zone] => SYSTEM [1] => SYSTEM [@@session.time_zone] => SYSTEM )
How come the session looses its time_zone setting? Most the time it returns the correct value/time zone but ever 4th or 5th query it is the wrong time zone. This is a big problem as the datetime fields are taking this into account when they are returned, thus messing up my further use of the datetimes.
default_date_timezone_set
function sets 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.