I change the default timezone from (Europe/Berlin) to (Asia/Kuwait) by date_default_timezone_set() function but when I change some code’s by javascript ajax it return to (Europe/Berlin) as default timezone why?
@NogDogFeb 10.2017 — #Probably not enough info to really tell. A more robust solution would be to change the PHP default timezone in the php.ini file for the web server, if possible, otherwise in a project-level .htaccess file if allowed.
If you have to do it via the date_default_timezone_set() function, then you need to make sure it gets done for each and every file that gets called by your site's links and JavaScript requests.
Also, if the JavaScript itself is doing any time-related stuff, it may be defaulting to the user's local machine settings. (I'm not a JS expert, so if that seems to be the issue, you'll want to ask on the JavaScript forum here. ? )
@BofasauthorFeb 11.2017 — #you'r right because Ajax response date/time in GMT format so I add date_default_timezone_set() function in each file that gets called
@wbportFeb 13.2017 — #I am still new to php, but the JavaScript date/time function of[CODE]getTimezoneOffset()[/CODE] will return in minutes the difference between the user's time zone and GMT. It returns a positive number in the Western hemisphere and negative in the Eastern so you might have to negate it after dividing by 60.