Your Javascript statements are producing the expected results. Tue May 26 2015 14:00:00 GMT+0100 is the same time as 2015-05-26T13:00:00.000Z. Unless you care about a fraction of a second, GMT, UTC, and Z all mean the same thing: mean solar time at 0° longitude, and keeping the same time all year (no change in summer; Iceland observes this time all year). "GMT+0100" means a time zone that is one hour later than 0° longitude, such the United Kingdom in summer. So at a given moment the time in Iceland is 2015-05-26T13:00:00.000Z and also Tue May 26 2015 14:00:00 GMT+0100 in London. Could you clarify what result you want to see? Perhaps you would like "2015-05-26T14:00:00" which is the ISO 8601 notation for some unspecified local time, presumably the local time of the computer displaying the Javascript. Or maybe you want "2015-05-26T14:00:00+01:00", which is ISO 8601 notation for the local time zone one hour ahead of 0° longitude, such as London in summer or Paris in winter.
Building on souldreamer's example, making it fully working and providing the local time offset:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<body>
<pre>
<script language="JavaScript">
if (!Date.prototype.toLocalISOString) {
// Anonymous self-invoking function
(function () {
function pad(number) {
if (number < 10) {
return '0' + number;
}
return number;
}
Date.prototype.toLocalISOString = function () {
timestamp = this.getFullYear() +
'-' + pad(this.getMonth() + 1) +
'-' + pad(this.getDate()) +
'T' + pad(this.getHours()) +
':' + pad(this.getMinutes()) +
':' + pad(this.getSeconds());
if (this.getTimezoneOffset() == 0) { timestamp = timestamp + "Z" }
else {
if (this.getTimezoneOffset() < 0) { timestamp = timestamp + "+" }
else { timestamp = timestamp + "-" }
timestamp = timestamp + pad(Math.abs(this.getTimezoneOffset() / 60).toFixed(0));
timestamp = timestamp + ":" + pad(Math.abs(this.getTimezoneOffset() % 60).toFixed(0));
}
return timestamp;
};
}());
}
now = new Date();
document.writeln("Create date object containing present time and print UTC version.");
document.writeln(now.toUTCString());
document.writeln("Show local time version");
document.writeln(now.toLocalISOString());
</script>
</pre>