Im using this code to retrieve an entity with a datetime field. When i retrieve the field i get it in this format "Date(16456222000000)" as string, how can i transform that to a date that i can compare?
function retrieveRecord(recordId) { var clientURL = Xrm.Page.context.getClientUrl(); var req = new XMLHttpRequest(); var query = "/api/data/v8.2/entitySetName?$filter= idlogicalname eq " + recordId; req.open("GET", encodeURI(clientURL + query), true); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json;charset=utf-8"); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.onreadystatechange = function () { if (this.readyState == 4) { req.onreadystatechange = null; if (this.status == 200) { var data = JSON.parse(this.response); } else { var error = JSON.parse(this.response).error; alert("Error retrieving Record – " + error.message); } } }; req.send(); }