|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.castor.types.DateTimeBase
org.exolab.castor.types.DateTime
public class DateTime
Describe an XML schema DateTime.
The format is defined by W3C XML Schema Recommendation and ISO8601 i.e (-)CCYY-MM-DD'T'HH:MM:SS(.SSSSS)(Z|(+|-)hh:mm)
Field Summary |
---|
Fields inherited from class org.exolab.castor.types.DateTimeBase |
---|
EQUALS, GREATER_THAN, INDETERMINATE, LESS_THAN, MAX_TIME_ZONE_COMPARISON_OFFSET, WRONGLY_PLACED |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
Methods inherited from class org.exolab.castor.types.DateTimeBase |
---|
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, toCalendar |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public 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 date
java.text.ParseException
- if we are passed an illegal valueMethod Detail |
---|
public void setValues(short[] values)
setZone
. A time zone
previously set will not be cleared.
setValues
in class DateTimeBase
values
- An array of shorts containing the values for the DateTimepublic short[] getValues()
getValues
in class DateTimeBase
public java.util.Date toDate()
toDate
in class DateTimeBase
public long toLong()
public java.lang.String toString()
toString
in class java.lang.Object
public static DateTime parse(java.lang.String str) throws java.text.ParseException
str
- the string to parse
java.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 parse
java.text.ParseException
- If the string to parse does not follow the right format
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |