I have two fields Date type, i would like about how to calculate time among them 2 using JavaScript
*This post is locked for comments
Thanks so much! I need to pay more attention XD
My code
var dt1= Xrm.Page.getAttribute("new_date1").getValue();
var dt2= Xrm.Page.getAttribute("new_date2").getValue();
var h= Xrm.Page.getAttribute("new_hours").getValue();
var hours = 60*60*1000;
if (date1!= null && date2!=null) {
var diffHours = Math.round(Math.abs((dt2.getTime() - dt1.getTime())/(hours)));
}
h.setValue(diffHours );
------
but don't working
In addition to what Guido states, you'll have to take some other things into account...
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156