JAVA/CORBA CLASSES
Examples: DateTime class
1. This agent creates a new DateTime object and prints it 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("12/12/97
04:30:00 PM");
System.out.println(dt.getLocalTime());
System.out.println(dt.getGMTTime());
} catch(Exception e) {
e.printStackTrace();
}
}
}
2. This script creates a new DateTime object that represents today's date and then prints it in local time. The time component of the DateTime object is not set.
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");
System.out.println(dt.getLocalTime());
} catch(Exception e) {
e.printStackTrace();
}
}
}
3. This script creates two new DateTime objects. The first represents January 15, 1900; the second represents January 15, 2000.
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext =
session.getAgentContext();
// (Your code goes here)
DateTime dt1 = session.createDateTime("01/15/1900");
DateTime dt2 = session.createDateTime("01/15/00");
System.out.println(dt1.getLocalTime());
System.out.println(dt2.getLocalTime());
} catch(Exception e) {
e.printStackTrace();
}
}
}
See Also
DateTime class
Glossary
Help on Help
Open Full Help Window
Glossary
Help on Help
Open Full Help Window