Domino Code Fragment

Code Name*
lotus.notes.DateRange class
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.141.244.201
Description*
2. This example sets the StartDateTime and EndDateTime properties of a lotus.notes.DateRange object through the property methods, then displays the value of the Text property
Type*
Java
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
import lotus.notes.*;


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