Personalized Community is here!
Quickly customize your community to find the content you seek.
Have questions on moving to the cloud? Visit the Dynamics 365 Migration Community today! Microsoft’s extensive network of Dynamics AX and Dynamics CRM experts can help.
2021 Release Wave 1Discover the latest updates and new features to Dynamics 365 planned April 2021 through September 2021.
Release overview guides and videos Release Plan | Preview 2021 Release Wave 1 Timeline
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
I am able to read the value but it is not exactly same what I can see in CRM.Date t
In CRM Form, selected value is: 11 Nov 2020 8:00am
How do i make JS read write value
Depending on exactly what you are wanting to do the answer may be slightly different, and the methods may be different, but on a Date object .toLocaleDateString() or .toLocaleDateString("<country code>") if you want it in a specific country timezone etc (also a similar method exists exists for the time component).
You can use getTimeZoneOffsetMinutes function from global context as below to get the correct date and time value.
var dateTimeFieldValue = Xrm.Page.getAttribute("FieldName").getValue()
var utcDate = new Date(dateTimeFieldValue.getUTCFullYear() , dateTimeFieldValue.getUTCMonth() , dateTimeFieldValue.getUTCDate(), dateTimeFieldValue.getUTCHours(), dateTimeFieldValue.getUTCMinutes(), dateTimeFieldValue.getUTCSeconds() ,dateTimeFieldValue.getUTCMilliseconds());
var correctFieldDateTimeValue = new Date(utcDate.setMinutes(utcDate.getMinutes() + Xrm.Utility.getGlobalContext().userSettings.getTimeZoneOffsetMinutes()));
Hope this helps!
Business Applications communities