Notifications
Announcements
No record found.
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
In addition to what Guido states, you'll have to take some other things into account...
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
Thanks so much! I need to pay more attention XD
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2