kalster Posted May 28, 2014 Share Posted May 28, 2014 instead of js alert displaying the timezone offset, i would like the content of get_time_zone_offset() to be used as a php variable. <script type="text/javascript"> function get_time_zone_offset( ) { var current_date = new Date(); return -current_date.getTimezoneOffset() / 60; } alert("The local time zone is: GMT " + get_time_zone_offset()); </script> Quote Link to comment https://forums.phpfreaks.com/topic/288851-timezone-offset/ Share on other sites More sharing options...
PravinS Posted May 29, 2014 Share Posted May 29, 2014 you can use PHP time zone instead of javascript time zone Quote Link to comment https://forums.phpfreaks.com/topic/288851-timezone-offset/#findComment-1481234 Share on other sites More sharing options...
cyberRobot Posted May 29, 2014 Share Posted May 29, 2014 you can use PHP time zone instead of javascript time zone Unless I'm missing something, that's just going to get the time zone for the server which may not match the time zone for the visitor. instead of js alert displaying the timezone offset, i would like the content of get_time_zone_offset() to be used as a php variable. You could look into using AJAX to communicate with PHP. Or could also look into passing the information through an HTML form. Quote Link to comment https://forums.phpfreaks.com/topic/288851-timezone-offset/#findComment-1481274 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.