public class DateTime extends DateTimeBase
The format is defined by W3C XML Schema Recommendation and ISO8601 i.e (-)CCYY-MM-DD'T'HH:MM:SS(.SSSSS)(Z|(+|-)hh:mm)
EQUALS, GREATER_THAN, INDETERMINATE, LESS_THAN, MAX_TIME_ZONE_COMPARISON_OFFSET, WRONGLY_PLACED| Constructor and Description |
|---|
DateTime()
Default constructor.
|
DateTime(java.util.Date dateRef)
Creates a new XML Schema DateTime instance from a java.util.Date.
|
DateTime(long dateAsLong)
Creates a new XML Schema DateTime instance from a long that represents a
Date.
|
DateTime(short[] values)
Constructs a XML Schema DateTime instance given all the values of the
different date and time (but not time zone) fields.
|
DateTime(java.lang.String date)
Constructs a DateTime from a String.
|
| Modifier and Type | Method and Description |
|---|---|
short[] |
getValues()
Returns an array of shorts with all the fields that describe this
DateTime type.
|
static DateTime |
parse(java.lang.String str)
Parses a String into a new DateTime instance.
|
static DateTime |
parseDateTime(java.lang.String str)
Parses a String into a new DateTime instance.
|
void |
setValues(short[] values)
Sets all the fields to the values provided in an Array.
|
java.util.Date |
toDate()
Converts this DateTime into a local java.util.Date.
|
long |
toLong()
Converts this DateTime into a long value representing a java.util.Date.
|
java.lang.String |
toString()
Converts this DateTime to a string.
|
addDuration, appendDateString, appendTimeString, appendTimeZoneString, clone, compareTo, equal, equals, getCentury, getDay, getHour, getMilli, getMinute, getMonth, getSeconds, getYear, getZoneHour, getZoneMinute, hasCentury, hasDay, hashCode, hasHour, hasIsNegative, hasMilli, hasMinute, hasMonth, hasSeconds, hasYear, isLeap, isNegative, isUTC, isZoneNegative, normalize, parseDay, parseMonth, parseTime, parseTimeZone, parseYear, setCentury, setDateFormatTimeZone, setDateFormatTimeZone, setDay, setHour, setMilliSecond, setMinute, setMonth, setNegative, setSecond, setSecond, setUTC, setYear, setZone, setZoneHour, setZoneMinute, setZoneNegative, toCalendarpublic DateTime()
public DateTime(short[] values)
By default a DateTime is not UTC, and is local. To set a timezone, you
need to separately call DateTimeBase.setZone(short, short).
values - an array of shorts that represent the different fields of
Time.setValues(short[])public DateTime(long dateAsLong)
By default a DateTime is not UTC, and is local. To set a timezone, you
need to separately call DateTimeBase.setZone(short, short).
dateAsLong - java.util.Date represented as a long.public DateTime(java.util.Date dateRef)
By default a DateTime is not UTC, and is local. To set a timezone, you
need to separately call DateTimeBase.setZone(short, short).
dateRef - a java.util.Date to convert.public DateTime(java.lang.String date)
throws java.text.ParseException
date - the string representing the datejava.text.ParseException - if we are passed an illegal valuepublic void setValues(short[] values)
setZone. A time zone
previously set will not be cleared.setValues in class DateTimeBasevalues - An array of shorts containing the values for the DateTimepublic short[] getValues()
getValues in class DateTimeBasepublic java.util.Date toDate()
toDate in class DateTimeBasepublic long toLong()
public java.lang.String toString()
toString in class java.lang.Objectpublic static DateTime parse(java.lang.String str) throws java.text.ParseException
str - the string to parsejava.text.ParseException - If the string to parse does not follow the right formatpublic static DateTime parseDateTime(java.lang.String str) throws java.text.ParseException
str - the string to parsejava.text.ParseException - If the string to parse does not follow the right formatIntalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com