Skip to content

Instantly share code, notes, and snippets.

View kristofferh's full-sized avatar
🍔

Kristoffer Hedstrom kristofferh

🍔
View GitHub Profile
@kristofferh
kristofferh / jsonDate.js
Created March 16, 2011 17:39
Convert a jsonDate (something like /Date(1284604200000-0700)/, .NET likes this) to something more human readable
/**
* convert a JSONDATE (something like /Date(1284604200000-0700)/) to something more human readable
*/
function jsonDate(str) {
return new Date(parseInt(str.replace(/\/Date\((.*?)\)\//gi, "$1"), 10));
}
// jsonDate('/Date(1284604200000-0700)/');
// -> Wed Sep 15 2010 19:30:00 GMT-0700 (PDT)
var isMSIE = /*@cc_on!@*/false;
var isIE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;