I have a page which displays the local time for 10 cities around the world. However, because of the Daylight Saving Time (DST) one of the times is out by an hour.
Using JavaScript, I want to be able to check for DST to ensure that the times displayed are always correct. This cannot be client specific as this page is used by people around the world.
Here is a bit of the code that I'm currently using:
var today = new Date();
today = convertDateToUTC(today);
var houston = today.addHours(-6);
var houstonHours = houston.getHours();
var houtstonMinutes = houston.getMinutes();
var houstonTime = houstonHours + ":" + houtstonMinutes;
document.getElementById('houston').innerHTML = houstonTime;
today = new Date();
today = convertDateToUTC(today);
function convertDateToUTC(date) {
return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
}