Krishna_ramisetty Posted April 29, 2021 Share Posted April 29, 2021 Hello Everyone, I am on windows server and In my ini file server time zone declared as below [server_settings] date.timezone = "Europe/London" but my application installed on another timezone eg: 'America/Los_Angeles' time zone. using date_default_timezone_get() i am always getting Europe/London timezone as it's declared in ini file. How to get local timezone(wherever application is installed) here? Thanks Krish Quote Link to comment https://forums.phpfreaks.com/topic/312565-how-to-get-my-local-timezone-irrespective-of-my-ini-file-server-time-zone/ Share on other sites More sharing options...
requinix Posted April 29, 2021 Share Posted April 29, 2021 PHP won't try to guess your timezone. Tell it explicitly what you want with date.timezone. Like realistically, how often are you moving servers? Quote Link to comment https://forums.phpfreaks.com/topic/312565-how-to-get-my-local-timezone-irrespective-of-my-ini-file-server-time-zone/#findComment-1586239 Share on other sites More sharing options...
maxxd Posted April 30, 2021 Share Posted April 30, 2021 PHP is a server-side language, so it only knows the timezone the server is in. As requinix says, you have to tell it what timezone to use. There are a couple different ways to do it - either ask the user or use a JavaScript library and pass the data to the PHP. Quote Link to comment https://forums.phpfreaks.com/topic/312565-how-to-get-my-local-timezone-irrespective-of-my-ini-file-server-time-zone/#findComment-1586243 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.