sourcedatimefield is the value of datetime fileld stored in database for the Entity.
var datetimecontroltobind= Xrm.Page.data.entity.attributes.get("new_datetimecontroltobind");
var sourcedatimefield= sourcedatimefield.split('/');
var sourcedatimefield1=sourcedatimefield[1] + '/' + sourcedatimefield[0] + '/' +sourcedatimefield[2];
var sourcedatimefield2=sourcedatimefield1.split(' ');
var sourcedatimefield3=sourcedatimefield2[1].split(':');
datetimecontroltobind.setValue(new Date(sourcedatimefield2[0]));
datetimecontroltobind.setValue(datetimecontroltobind.getValue().setHours(sourcedatimefield3[0],sourcedatimefield3[1],0))
Comments
Post a Comment