Javascript is a client language and does not interact with the server in this way. You will need to extract this data from your server platform.
Here are some PHP code to get the data you are looking for. You will need to put this on your page and repeat the result in the JS variable ....
<?php $date = new DateTime(null, new DateTimeZone('Europe/London')); $tz = $date->getTimezone(); $tzone = $tz->getName(); ?> <script type="text/javascript"> var timeZone='<?php echo $tzone ?>'; </script>
.... or leave the PHP page separate and retrieve data using AJAX
getTimeZone.php
<?php $date = new DateTime(null, new DateTimeZone('Europe/London')); $tz = $date->getTimezone(); echo $tz->getName(); ?>
Js
var timeZone=null; $.get('getTimeZone.php', function(result){ timeZone=result; }, 'html');
source share