Domino Code Fragment

Code Name*
lotus.notes.DateRange class
Date*
04/29/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.15.218.254
Description*
4. This example sets a value for a lotus.notes.DateRange object, then changes the lotus.notes.DateTime object that the EndDateTime property is based on. This implicitly changes the EndDateTime property.
Type*
Java
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
import lotus.notes.*;


public class daterange4agent extends AgentBase
{
 public void NotesMain()
 {
   try
   {
     Session s = getSession();
     AgentContext ac = s.getAgentContext();
     Database db = ac.getCurrentDatabase();
     DateTime dtdb = db.getCreated();
     DateTime dtplus = s.createDateTime(null);
     dtplus.setNow();
     DateRange dr = s.createDateRange(dtdb, dtplus);
     dtplus.adjustMonth(2);
     System.out.println
     ("Creation date - 2 months from now:");
     System.out.println
     ("  " + dr.getText());
   }
   catch (Exception e)
   {
     e.printStackTrace();
   }
 }
}