JAVA/CORBA CLASSES
Examples: LocalTime property
1. This agent prints the creation date and time of the current database in local time.
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();
String sLocalTime = createdDateTime.getLocalTime();
System.out.println
("Database \"" + db.getTitle() +
"\" was created on " + sLocalTime + ".");
} catch(Exception e) {
e.printStackTrace();
}
}
}
2. This agent sets the local date and time, then prints the date and time in local time and GMT.
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext =
session.getAgentContext();
// (Your code goes here)
DateTime dt = session.createDateTime("Today");
dt.setLocalTime("12/12/97 04:30:00 PM");
System.out.println(dt.getLocalTime());
System.out.println(dt.getGMTTime());
} catch(Exception e) {
e.printStackTrace();
}
}
}
3. This agent is the same as above but passes the date and time as integer values to setLocalDate and setLocalTime, rather than as a string to setLocalTime.
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext =
session.getAgentContext();
// (Your code goes here)
DateTime dt = session.createDateTime("Today");
dt.setLocalDate(1997, 12, 12, true);
dt.setLocalTime(1, 30, 0, 0);
System.out.println(dt.getLocalTime());
System.out.println(dt.getGMTTime());
} catch(Exception e) {
e.printStackTrace();
}
}
}
See Also
LocalTime property
Glossary
Feedback on
Help
or
Product Usability
?
Help on Help
All Help Contents
Glossary