Nandini Posted September 10, 2008 Share Posted September 10, 2008 Hi friends I am doing a website using php and mysql on LINUX. I want to put select timezone dropdown in the header of my website. My client requirement is when user select any timezone immediatly the user system time will change according to the selected timezone. For example: If user is in india. He has select usa timezone, then his system time will be converted to usa time. I have a html form. But i dont how set the time zone. Here is my form script: <select name="timezoneoffset"> <option value="-12" >(GMT -12:00 hours) Eniwetok, Kwajalein</option> <option value="-11" >(GMT -11:00 hours) Midway Island, Samoa</option> <option value="-10" >(GMT -10:00 hours) Hawaii</option> <option value="-9" >(GMT -9:00 hours) Alaska</option> <option value="-8" >(GMT -8:00 hours) Pacific Time (US & Canada)</option> <option value="-7" >(GMT -7:00 hours) Mountain Time (US & Canada)</option> <option value="-6" >(GMT -6:00 hours) Central Time (US & Canada), Mexico City</option> <option value="-5" selected>(GMT -5:00 hours) Eastern Time (US & Canada), Bogota, Lima, Quito</option> <option value="-4" >(GMT -4:00 hours) Atlantic Time (Canada), Caracas, La Paz</option> <option value="-3.5" >(GMT -3:30 hours) Newfoundland</option> <option value="-3" >(GMT -3:00 hours) Brazil, Buenos Aires, Georgetown</option> <option value="-2" >(GMT -2:00 hours) Mid-Atlantic</option> <option value="-1" >(GMT -1:00 hours) Azores, Cape Verde Islands</option> <option value="0" >(GMT) Western Europe Time, London, Lisbon, Casablanca, Monrovia</option> <option value="+1" >(GMT +1:00 hours) CET(Central Europe Time), Brussels, Copenhagen, Madrid, Paris</option> <option value="+2" >(GMT +2:00 hours) EET(Eastern Europe Time), Kaliningrad, South Africa</option> <option value="+3" >(GMT +3:00 hours) Baghdad, Kuwait, Riyadh, Moscow, St. Petersburg, Volgograd, Nairobi</option> <option value="+3.5" >(GMT +3:30 hours) Tehran</option> <option value="+4" >(GMT +4:00 hours) Abu Dhabi, Muscat, Baku, Tbilisi</option> <option value="+4.5" >(GMT +4:30 hours) Kabul</option> <option value="+5" >(GMT +5:00 hours) Ekaterinburg, Islamabad, Karachi, Tashkent</option> <option value="+5.5" >(GMT +5:30 hours) Bombay, Calcutta, Madras, New Delhi</option> <option value="+6" >(GMT +6:00 hours) Almaty, Dhaka, Colombo</option> <option value="+7" >(GMT +7:00 hours) Bangkok, Hanoi, Jakarta</option> <option value="+8" >(GMT +8:00 hours) Beijing, Perth, Singapore, Hong Kong, Chongqing, Urumqi, Taipei</option> <option value="+9" >(GMT +9:00 hours) Tokyo, Seoul, Osaka, Sapporo, Yakutsk</option> <option value="+9.5" >(GMT +9:30 hours) Adelaide, Darwin</option> <option value="+10" >(GMT +10:00 hours) EAST(East Australian Standard), Guam, Papua New Guinea, Vladivostok</option> <option value="+11" >(GMT +11:00 hours) Magadan, Solomon Islands, New Caledonia</option> <option value="+12" >(GMT +12:00 hours) Auckland, Wellington, Fiji, Kamchatka, Marshall Island</option> </select> Can any one help me out Thanx Quote Link to comment https://forums.phpfreaks.com/topic/123596-php-timezone-dropdown/ Share on other sites More sharing options...
JonnoTheDev Posted September 10, 2008 Share Posted September 10, 2008 By setting an environment variable: putenv("TZ=US/Eastern"); This would have to be at the top of each file so when you use the date() function it uses the correct zone. Quote Link to comment https://forums.phpfreaks.com/topic/123596-php-timezone-dropdown/#findComment-638308 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.