JustinK101 Posted July 16, 2008 Share Posted July 16, 2008 I need a way to detect if a user is currently on daylight savings time. Is this more of a javascript question? Link to comment https://forums.phpfreaks.com/topic/114965-detect-if-daylight-savings-enabled/ Share on other sites More sharing options...
ratcateme Posted July 16, 2008 Share Posted July 16, 2008 a quick google says it is not possiable with PHP and gave me this javascript <script type="text/javascript"> document.getElementById('timezone').value = new Date().getTimeZoneOffset(); // this should all be in one line </script> Scott. Link to comment https://forums.phpfreaks.com/topic/114965-detect-if-daylight-savings-enabled/#findComment-591264 Share on other sites More sharing options...
JustinK101 Posted July 16, 2008 Author Share Posted July 16, 2008 That built in JS function I guess has issues. FYI to others, this guy wrote a nice script, which works through-out the world. http://onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/#comment-233 Link to comment https://forums.phpfreaks.com/topic/114965-detect-if-daylight-savings-enabled/#findComment-591273 Share on other sites More sharing options...
cooldude832 Posted July 16, 2008 Share Posted July 16, 2008 php can do it http://us3.php.net/manual/en/function.date.php Look at the "I" parameter for the date function Link to comment https://forums.phpfreaks.com/topic/114965-detect-if-daylight-savings-enabled/#findComment-591280 Share on other sites More sharing options...
PFMaBiSmAd Posted July 16, 2008 Share Posted July 16, 2008 date() uses the server's time and time zone setting, not the user's time. Link to comment https://forums.phpfreaks.com/topic/114965-detect-if-daylight-savings-enabled/#findComment-591283 Share on other sites More sharing options...
cooldude832 Posted July 16, 2008 Share Posted July 16, 2008 didn't see the user part. Php can't do much about the user since it compiles everything server side and Prehypertext processing Link to comment https://forums.phpfreaks.com/topic/114965-detect-if-daylight-savings-enabled/#findComment-591288 Share on other sites More sharing options...
PFMaBiSmAd Posted July 16, 2008 Share Posted July 16, 2008 The script at that link will detect the timezone, but assuming you want that information on the server (you did ask in a php forum), it still needs to be sent to the server. You can use a modified version of the code at this link to get any information available in the browser to a php script on the server - http://www.php.net/manual/en/faq.html.php#faq.html.javascript-variable Link to comment https://forums.phpfreaks.com/topic/114965-detect-if-daylight-savings-enabled/#findComment-591292 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.