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:.18.225.209.95
Description*
1. This example sets the StartDateTime and EndDateTime properties of a lotus.notes.DateRange object through the createDateRange parameters, then displays the value of the Text property.
Type*
Java
Categories*
Date/Time Handling
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
import lotus.notes.*;


public class daterange1agent 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(dtdb, dtnow);
     System.out.println
     ("Creation date - now:");
     System.out.println
     ("  " + dr.getText());
   }
   catch (Exception e)
   {
     e.printStackTrace();
   }
 }
}