Is there any way to calculate difference in date. I have xml profile as input.
And i want to compare date with current date and calculate difference.
Is there any way to do this in Boomi?
I have created a map-function like below to do that:
var _MS_PER_DAY = 1000 * 60 * 60 * 24;var a = new Date();var b = new Date(QUITDATE); // Or any other JS date
// Discard the time and time-zone information. var utc1 = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate()); var utc2 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate());
var active = Math.floor((utc2 - utc1) / _MS_PER_DAY);
Hi Kaustubh Vivek
I have used below simple script to calculate date difference in days. You can modify this as per your requirement.
var date1 = new Date('2017/09/25');var date2 = new Date('2016/04/28');var start = Math.floor(date1.getTime() / (3600 * 24 * 1000)); //days as integer from..var end = Math.floor(date2.getTime() / (3600 * 24 * 1000)); //days as integer from..var daysDiff = start - end; // exact dates
i am getting the below error after using your code.
Error executing custom script: ReferenceError: "document" is not defined in <eval> at line number 6.
Retrieving data ...