Skip to content

Instantly share code, notes, and snippets.

@orhanveli
Created November 14, 2011 20:56
Show Gist options
  • Save orhanveli/1365135 to your computer and use it in GitHub Desktop.
Save orhanveli/1365135 to your computer and use it in GitHub Desktop.
Formatting ASP.NET [Webmethods] seriliazed DateTime objects on javascript side
(function ($) {
$.dateNet = function (date) {
if (date === null || date === undefined) return null;
if (/\/Date\([0-9\+]*\)\//.test(date))
return eval('new ' + date.split('/')[1]);
return '/Date(' + date.getTime() + ')/';
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment