Skip to content

Instantly share code, notes, and snippets.

@rafidka
Created April 26, 2013 08:57
Show Gist options
  • Save rafidka/5465868 to your computer and use it in GitHub Desktop.
Save rafidka/5465868 to your computer and use it in GitHub Desktop.
Date.parseWcfDate = function(str) {
var regex = str.match(/\/Date\(([0-9]+)([-+])([0-9]+)\)\//);
var millisecs = parseInt(regex[1]);
var offset = parseFloat(regex[2] + regex[3]) / 100;
var utcMillsecs = millisecs + offset * 3600 * 1000;
return new Date(utcMillsecs);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment