function dateFromGMTString(str) {
var x=str.match(/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})\.(\d{1,3})Z/);
return new Date(x[1],(+x[2])-1,x[3],x[4],x[5],x[6],x[7]);
}
UPDATE:
You can try to use Date.parse()
method instead of Date contructor for converting GMT (JSON) like dates into javascript Date
object. In this case you can try to "patch" Date.parse()
for IE using next code example. Simply add this code anywhere in begining of your page javascript code:
if(Date.parse("2000-01-01T00:00:00.000Z")+new Date().getTimezoneOffset()*60000!==(+new Date(2000,0,1,0,0,0,0))) {
(function() { // closure
var rg=/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})\.(\d{1,3})Z/,
parseOriginal=Date.parse;
Date.parse=function(str) {
var x=str.match(rg);
return x?(+new Date(x[1],(+x[2])-1,x[3],x[4],x[5],x[6],x[7]))-new Date().getTimezoneOffset()*60000:parseOriginal.call(Date,str);
}
})();
}
After above code is executed you can use Date.parse()
in all browsers (including IE) to convert string dates into javascript date objects using next code:
new Date(Date.parse("2011-12-26T13:55:49.377Z"));