Examples: setNow method

This agent increments the current time by 2 months and appends this value to the PurgeDate item.

import lotus.domino.*;
public class JavaAgent extends AgentBase {
  public void NotesMain() {
    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();
      // (Your code goes here) 
      Database db = agentContext.getCurrentDatabase();
      Document doc = db.createDocument();
      DateTime dt = session.createDateTime("Today");
      dt.setNow();
      dt.adjustMonth(2, true);
      doc.appendItemValue("Form", "Main Topic");
      doc.appendItemValue("Subject", "2-month document");
      doc.appendItemValue("PurgeDate", dt);
      doc.save(true, true);
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}