Date time format issue in CRM 2015 when using oData SDK.JQuery.retrieveRecordSync

Posted on Posted in CRM 2013 SDK, MS CRM 2013, MS CRM 2015

When retrieving data in CRM using JQuery datetime comes back in int format with some back/forward slash.

Below is sample script how to remove back clash and forward slash and then covert to proper date time. Once converted we can compare two date times.

var result = SDK.JQuery.retrieveRecordSync(Context.newValues.MyItemId, “rok_abc”, “rok_xyz”, null);

dt =;
dt = dt.replace(“/Date(“, “”);
dt = dt.replace(/\\/g, “”);
dt = dt.replace(“)”, “”);
dt = dt.replace(/\//g, “”);
var promisedDt = new Date(parseInt(dt, 10));
var startDt = new Date(parseInt(Date.parse(Context.newValues.StartTime), 10));

if (startDt > promisedDt)
alert(‘We are cool’);