例: timeDifference method

次のエージェントは、文書の作成時点から経過した日数を計算します。

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();
      DateTime createdDateTime = db.getCreated();
      DateTime nowDateTime = session.createDateTime("Today");
      nowDateTime.setNow();
      int daysSinceCreated =
      nowDateTime.timeDifference(createdDateTime) / 86400;
      System.out.println
      ("Database ¥"" + db.getTitle() +
      "¥" was created " + daysSinceCreated + " days ago.");
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}