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

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’);

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>