Domino Code Fragment
| Code Name* lotus.notes.DateRange class | Date* 10/31/2025 | Source (or email address if you prefer)* [email protected] IP address:.172.70.179.54 | |
| 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: | |
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();
    }
  }
}