Hi, I need to subtract dates. At Excel I can simply subtract two cells with dates as they are numbers.
Similarly Ineed to add number of days to one date to get another date.
Thank you for script or any idea.
Josef
Hi, I need to subtract dates. At Excel I can simply subtract two cells with dates as they are numbers.
Similarly Ineed to add number of days to one date to get another date.
Thank you for script or any idea.
Josef
Hi Josef, I’ve solved this like
debugger;
var D1= doo.model.<[D1 (D1)]>;
var D2 = doo.model.<[D2 (D2)]>;
doo.model.<[DIff (dIff)]>.setValue(Math.ceil((D2.value-D1.value)/3600/24/1000));
hope this works for you
James
Hi James. Thank you for your help. But it is not working even when I replaced ceil for cell.
Please, give a look at enclosed picture. Thank you.
Josef
Hello Josef,
This works for me.
let d1 = doo.model.<[Date (date)]>.value;
let d2= doo.model.<[Date 2 (date2)]>.value;
doo.model.<[date 3 (date3)]>.value = Math.round((new Date(d2).valueOf() - new Date(d1).valueOf())/1000/60/60/24);
With kind regards,
Soňa
Hello Soňa.
Thank you for your answer. But I cannot believe it does not work at my table.
Please see the picture:
The mistake is the same as it was for code from James.
With kind regards,
Josef
Hello Josef,
Have you renamed the field names according to your application? Please check and if it still doesn’t work, please let me know at sona.sturmova@tabidoo.cloud.
Thank you
With kind regards,
Soňa