JAVA/CORBA CLASSES
Represents a date and time.
Syntax
public class DateTime extends Base
Containment
Contained by: AgentContext, Database, DateRange, DateTime, Document, Session, and View
Properties
DateOnly through getDateOnly
GMTTime through getGMTTime
IsDST through isDST
LocalTime through getLocalTime, setLocalTime, and setLocalDate
Parent through getParent
TimeOnly through getTimeOnly
TimeZone through getTimeZone
ZoneTime through getZoneTime
Methods
adjustDay
adjustHour
adjustMinute
adjustMonth
adjustSecond
adjustYear
convertToZone
recycle
setAnyDate
setAnyTime
setNow
timeDifference
toJavaDate
toString
Creation
To create a new DateTime object, use createDateTime in Session.
Usage
After creating a DateTime object with createDateTime, you can reset the date and time with setLocalTime and setLocalDate. The createDateTime method takes a String, java.util.Date, or java.util.Calendar parameter. One form of setLocalTime takes a String parameter, another form takes a java.util.Date parameter, and a third form takes a java.util.Calendar parameter. Other forms of setLocalTime and setLocalDate take multiple int parameters.
The String form of the date parameter is a date, followed by a space, followed by a time. You can specify a date without a time, and a time without a date, but the time zone will not be set (see "Time zones" below).
The following applies when setting a date and time from a String value:
Time zones
When you create a new DateTime object, the time zone setting in Domino determines the TimeZone property. For example, if the code runs on a computer where the Domino time zone is set to Eastern Standard Time, the TimeZone property of any new DateTime object is automatically set to 5. The time zone setting also affects the GMTTime and LSGMTTime properties.
If you create a date without a time component or without a date component, the time zone is invalid and the TimeZone property returns 0. In this case, both LocalTime and GMTTime return the same time value without a time zone appended. If you apply convertToZone, the time zone remains invalid and TimeZone remains 0; no error occurs.
Today, Tomorrow, and Yesterday
When you create a new DateTime object using an expression such as "Today," "Tommorow," or "Yesterday," the value of the date is determined using the current date setting in Domino. These expressions have no effect on the time component of a DateTime object. To set a DateTime to the current date and time, specify the time after "Today" or "Yesterday" (for example, "Today 12:00:00 AM") or use setNow.
Access
To access a date-time value stored in an item in a Domino document, use getDateTimeValue in Item.
You can get the operating system date and time separators, and time zone settings through the International class.
Example See Also