I use the following on the m php website:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript" <script type="text/javascript"> $(function() { getStatus(); }); function getStatus() { <?php echo " var z = '".strftime("%Z",strtotime("now"))."';\n"; ?> var d = new Date(); var utc = d.getTime() + (d.getTimezoneOffset() * 60000); var offset = -8; if(z == "PDT") offset = -7; var currentTime = new Date(utc + (3600000*offset)); var currentHours = currentTime.getHours ( ); var currentMinutes = currentTime.getMinutes ( ); currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes; var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM"; currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours; currentHours = ( currentHours == 0 ) ? 12 : currentHours; var currentTimeString = currentHours + ":" + currentMinutes + ": " + timeOfDay + " " + z; $('td#clock').html(currentTimeString); setTimeout("getStatus()",5000); } </script>
Where I use the table, so this will fill
<table><tr><td id='clock'></td></tr></table>
over time from Los Angeles (PDT or PST), however, my server also works at this time, so sending strftime from your server may not have the same effect. But, as I said, it was my determination to get working time in another zone.
source share