{"id":58,"date":"2015-11-13T10:10:00","date_gmt":"2015-11-13T10:10:00","guid":{"rendered":"http:\/\/waynenguyen.org\/dev\/2015\/11\/13\/parse-microsoft-json-date\/"},"modified":"2016-05-21T03:15:52","modified_gmt":"2016-05-21T03:15:52","slug":"parse-microsoft-json-date","status":"publish","type":"post","link":"https:\/\/bruceng.com\/dev\/?p=58","title":{"rendered":"Parse and send Microsoft JSON Date using Javascript"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left;\" trbidi=\"on\">\nuse the following code<\/p>\n<p>var date = new Date(parseInt(jsonDateString.substr(6)));<\/p>\n<p>\nTo pass the date back to the ASP.NET server to deserialize, note that JSON.stringify will escape the slashes in the date values causing parse error in the server. To correct this, use the code below<br \/>\n(s<a href=\"http:\/\/stackoverflow.com\/questions\/11852432\/using-net-javascriptserializer-deserialize-with-datetime-from-client\">http:\/\/stackoverflow.com\/questions\/11852432\/using-net-javascriptserializer-deserialize-with-datetime-from-client<\/a>)<\/p>\n<pre class=\"default prettyprint prettyprinted\" style=\"background-color: #eeeeee; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;\">function customJSONstringify(obj) {\n    return JSON.stringify(obj).replace(\/\/Date\/g, \"\/Date\").replace(\/)\/\/g, \")\/\")\n}<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>use the following code var date = new Date(parseInt(jsonDateString.substr(6))); To pass the date back to the ASP.NET server to deserialize, note that JSON.stringify will escape the slashes in the date values causing parse error in the server. To correct this, use the code below (shttp:\/\/stackoverflow.com\/questions\/11852432\/using-net-javascriptserializer-deserialize-with-datetime-from-client) function customJSONstringify(obj) { return JSON.stringify(obj).replace(\/\/Date\/g, &#8220;\/Date&#8221;).replace(\/)\/\/g, &#8220;)\/&#8221;) }<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[20,25],"class_list":["post-58","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-javascript","tag-microsoft"],"_links":{"self":[{"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=\/wp\/v2\/posts\/58","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=58"}],"version-history":[{"count":1,"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=\/wp\/v2\/posts\/58\/revisions"}],"predecessor-version":[{"id":178,"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=\/wp\/v2\/posts\/58\/revisions\/178"}],"wp:attachment":[{"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=58"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=58"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=58"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}