Thanks for the nice analog clock. I would like to add a small part of code for anyone who want to integrate moment.js and set a timezone.
On function startClock(x,y), replace this code:
theDate = new Date();s = theDate.getSeconds();mins = theDate.getMinutes();m = mins + (s/60);hours = theDate.getHours();
With this one:
var continent='Europe'var city='London'theDate = moment();theDate.tz(continent+"/"+city).format();s = theDate.seconds(); mins = theDate.minutes(); m = mins + (s/60); hours = theDate.hour();
Make sure you call this 2 libraries:
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script><script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.13/moment-timezone-with-data.min.js"></script>
Thanks for the nice analog clock. I would like to add a small part of code for anyone who want to integrate moment.js and set a timezone.
On function startClock(x,y), replace this code:
theDate = new Date();
s = theDate.getSeconds();
mins = theDate.getMinutes();
m = mins + (s/60);
hours = theDate.getHours();
With this one:
var continent='Europe'
var city='London'
theDate = moment();
theDate.tz(continent+"/"+city).format();
s = theDate.seconds();
mins = theDate.minutes();
m = mins + (s/60);
hours = theDate.hour();
Make sure you call this 2 libraries:
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.13/moment-timezone-with-data.min.js"></script>