org.exolab.castor.types
public class Date extends DateTimeBase
The format is defined by W3C XML Schema Recommendation and ISO8601 i.e (-)CCYY-MM-DD(Z|(+|-)hh:mm)
Version: $Revision: 5951 $
Field Summary | |
---|---|
static String | DATE_FORMAT
The Date Format |
Constructor Summary | |
---|---|
Date() | |
Date(short[] values)
Constructs a XML Schema Date instance given all the values of
the different fields.
| |
Date(long dateAsLong)
This constructor is used to convert a long value representing a Date
to a new org.exolab.castor.types.Date instance.
| |
Date(Date dateRef)
This constructor is used to convert a java.util.Date into
a new org.exolab.castor.types.Date
Note : all the information concerning the time part of the java.util.Date is lost since a W3C Schema Date only represents CCYY-MM-YY | |
Date(String date)
Constructs a date from a string |
Method Summary | |
---|---|
short | getHour() |
short | getMilli() |
short | getMinute() |
short | getSeconds() |
short[] | getValues()
Returns an array of short with all the fields that describe
this Date type.
|
static Object | parse(String str)
parse a String and convert it into an java.lang.Object |
static Date | parseDate(String str)
parse a String and convert it into a Date. |
void | setHour(short hour) |
void | setMilliSecond(short millisecond) |
void | setMinute(short minute) |
void | setSecond(short second) |
void | setValues(short[] values)
Sets all the fields by reading the values in an array
if a Time Zone is specificied it has to be set by using
|
Date | toDate()
converts this Date into a local java Date. |
long | toLong()
Converts this date into a long value. |
String | toString()
convert this Date to a string
The format is defined by W3C XML Schema recommendation and ISO8601
i.e (+|-)CCYY-MM-DD |
Parameters: values an array of shorts that represent the different fields of Time.
Note : all the information concerning the time part of the java.util.Date is lost since a W3C Schema Date only represents CCYY-MM-YY
Parameters: dateAsLong Date represented in from of a long value.
Note : all the information concerning the time part of the java.util.Date is lost since a W3C Schema Date only represents CCYY-MM-YY
Parameters: date the string representing the date
Note:the time zone is not included.
Returns: an array of short with all the fields that describe this Date type.
Parameters: str the string to parse
Returns: an Object represented by the string
Throws: ParseException a parse exception is thrown if the string to parse does not follow the rigth format (see the description of this class)
Parameters: str the string to parse
Returns: the Date represented by the string
Throws: ParseException a parse exception is thrown if the string to parse does not follow the rigth format (see the description of this class)
if a Time Zone is specificied it has to be set by using
setZone
.
Parameters: values an array of shorts with the values
the array is supposed to be of length 4 and ordered like
the following:
Returns: a local date representing this Date.
Returns: This date instance as a long value.
Returns: a string representing this Date