|
||||||||||
| 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(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(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(String str)
Parses a String into a new DateTime instance. |
static DateTime |
parseDateTime(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. |
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. |
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(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(String date)
throws ParseException
date - the string representing the date
ParseException - if we are passed an illegal value| Method Detail |
|---|
public 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 Date toDate()
toDate in class DateTimeBasepublic long toLong()
public String toString()
toString in class Object
public static DateTime parse(String str)
throws ParseException
str - the string to parse
ParseException - If the string to parse does not follow the right format
public static DateTime parseDateTime(String str)
throws ParseException
str - the string to parse
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 | |||||||||