The excellent Pogo69 blog, which is an excellent resource for CRM developers has a blog post with a nice piece of Javascript to find the difference between two dates using Javascript.
He mentions that he is starting to build a Javascript library, which thanks to CRM 2011 we can now do because you can use the same Javascript file in many forms.
I am surprised that Microsoft haven’t already created some general Javascript libraries for everyone to use, surely their developers would have already done something like that or at least created enough Javascript to make one.
if (typeof DateLib == 'undefined') {
DateLib = {};
}
DateLib.Diff = function (from, to) {
return to - from;
}
DateLib.DiffMinutes = function (from, to) {
return DateLib.Diff(from, to) / (1000 * 60);
}
DateLib.DiffParts = function (from, to) {
var diff = DateLib.DiffMinutes(from, to);
var parts = new Object();
parts.Days = Math.floor(diff / (60 * 24));
diff -= (parts.Days * 60 * 24);
parts.Hours = Math.floor(diff / 60);
diff -= (parts.Hours * 60);
parts.Minutes = Math.floor(diff);
parts.Display =
(parts.Days > 0 ? parts.Days + " days, " : "") +
(parts.Hours > 0 ? parts.Hours + " hrs, " : "") +
(parts.Minutes + " mins");
return parts;
}
I simply couldn’t go away your site before suggesting that I actually enjoyed the usual info an individual supply on your guests? Is going to be again frequently to investigate cross-check new posts
LikeLike
I’m not entirely sure what you mean
LikeLike
Hosk could you do a quick write up to walk through this code please so I can better understand it? I’m new, thanks so much your posts help me learn a lot, I can’t stress enough how much I appreciate it.
LikeLike
I think he said “Couldn’t leave without saying how much I enjoyed the info that you supply to your guests, I’ll be calling back to check out new posts as they arrive…”
LikeLike
Hi friend
I need to create a new notes control without attachment option
Please help me .how to create
LikeLike
You can edit the existing notes functionality so you will need to create new functionality. I would probably create a new entity
LikeLike