Problem solve Get help with specific problems with your technologies, process and projects.

Calculating time difference in Formula language or LotusScript

I need to calculate the time difference between two dates in Formula language or LotusScript and then return the result in the format of "x months and y days." Do you know of any scripts or @Formulas that can do this?
I used a formula to calculate the difference. This does not include code for leap year and assumes that date1, the first date, is always earlier than date2. Here's the formula for a text field.

year1   := @IF(date1=""; 0; @Year(date1));
year2   := @IF(date2=""; 0; @Year(date2));
month1:= @IF(date1=""; 0; @Month(date1));
month2:= @IF(date2=""; 0; @Month(date2));
day1    := @IF(date1=""; 0; @day(date1));
day2    := @IF(date2=""; 0; @day(date2));
daysinmonth := @IF(date1=""; 
tempmonth:=@IF (year1=year2;
 month2 - month1;
 ((year2-year1)*12) + month2 - month1);
tempmonth - 1; 
 day2 - day1;
  daysinmonth + day2 - day1);
"sample: " + @text(months) + 
" months and " + @Text(days) + " days." 

Dig Deeper on Lotus Notes Domino Formula Language

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.



  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...