Examples: getValueDateTimeArray method
This agent gets the value of the date-time item named "Times." The agent checks each element of the value to see if it is a DateTime or DateRange object.
import lotus.domino.*;
import java.util.Vector;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
DocumentCollection dc = agentContext.getUnprocessedDocuments();
if (dc.getCount() > 0) {
Document doc = dc.getFirstDocument();
Item item = doc.getFirstItem("Times");
Vector times = item.getValueDateTimeArray();
for (int j=0; j<times.size(); j++) {
Object time = times.elementAt(j);
if (time.getClass().getName().endsWith("DateTime")) {
System.out.println
("Local time = " + ((DateTime)time).getLocalTime());
}
else if(time.getClass().getName().endsWith("DateRange")) {
System.out.println("Local time start and end = ");
System.out.println("\t" +
((DateRange)time).getStartDateTime().getLocalTime());
System.out.println("\t" +
((DateRange)time).getEndDateTime().getLocalTime());
}
}
}
} catch(Exception e) {
e.printStackTrace();
}
}
}