Get Date Part from Sqldate

Most of the time we need to set datatime field value in crm, but problem is that ms crm datetime file format is different from sql server date format so i have written a some js to get date part from sqlserver datetime field.
we can pass datetime value to this function and it will return date part from datetime value.
function GetDate(strCrmFormatDate)
var newDate=new Date();
var indexofT=strCrmFormatDate.indexOf(“T”);
var strdatepart=strCrmFormatDate.substring(0,indexofT);
var month=strdatepart.substring(5,7);
var year=strdatepart.substring(0,4);
var day=strdatepart.substring(8);

return newDate;

Leave a comment

Filed under MS CRM & Javascript

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s