|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Date
java.sql.Date
wt.util.WrappedDate
This class is a wrapper around java.sql.Date that corrects time zone related errors and dependencies that prevent java.sql.Date from fulfilling its contract:
java.sql.Date is a thin wrapper around java.util.Date that allows JDBC to identify this as a SQL DATE value. It adds formatting and parsing operations to support the JDBC escape syntax for date values.
Nested Class Summary | |
private static class |
WrappedDate.StandardCalendar
|
Field Summary | |
private WrappedDate.StandardCalendar |
cal
|
private static String |
timezoneId
|
Fields inherited from class java.sql.Date |
|
Fields inherited from class java.util.Date |
|
Constructor Summary | |
WrappedDate(int year,
int month,
int date)
Deprecated. Use WrappedDate(long) |
|
WrappedDate(long date)
Constructs a Date using a milliseconds time value. |
Method Summary | |
boolean |
after(Date when)
Tests if this date is after the specified date. |
boolean |
before(Date when)
Tests if this date is before the specified date. |
boolean |
equals(Object obj)
Compares two dates. |
int |
getDate()
Deprecated. As of JDK version 1.1, replaced by Calendar.get(Calendar.DAY_OF_MONTH) . |
int |
getDay()
Deprecated. As of JDK version 1.1, replaced by Calendar.get(Calendar.DAY_OF_WEEK) . |
int |
getMonth()
Deprecated. As of JDK version 1.1, replaced by Calendar.get(Calendar.MONTH) . |
long |
getTime()
Returns the number of milliseconds elapsed between January 1, 1970, 00:00:00 GMT and 00:00:00 GMT of this date. |
int |
getTimezoneOffset()
Deprecated. As of JDK version 1.1, replaced by Calendar.get(Calendar.ZONE_OFFSET) +
Calendar.get(Calendar.DST_OFFSET) . |
int |
getYear()
Deprecated. As of JDK version 1.1, replaced by Calendar.get(Calendar.YEAR) - 1900 . |
private void |
readObject(ObjectInputStream s)
readObject is called to restore a date from the stream. |
void |
setDate(int date)
Deprecated. As of JDK version 1.1, replaced by Calendar.set(Calendar.DAY_OF_MONTH, int date) . |
void |
setMonth(int month)
Deprecated. As of JDK version 1.1, replaced by Calendar.set(Calendar.MONTH, int month) . |
void |
setTime(long time)
Sets a Date using a milliseconds time value. |
void |
setYear(int year)
Deprecated. As of JDK version 1.1, replaced by Calendar.set(Calendar.YEAR, year + 1900) . |
String |
toString()
Formats a date in JDBC date escape format. |
static Date |
valueOf(String s)
Converts a string in JDBC date escape format to a Date value. |
private void |
writeObject(ObjectOutputStream s)
writeObject is called to save the Date to a stream. |
Methods inherited from class java.sql.Date |
getHours, getMinutes, getSeconds, setHours, setMinutes, setSeconds |
Methods inherited from class java.util.Date |
clone, compareTo, compareTo, hashCode, parse, toGMTString, toLocaleString, UTC |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
private static String timezoneId
private transient WrappedDate.StandardCalendar cal
Constructor Detail |
public WrappedDate(int year, int month, int date)
year
- year-1900month
- 0 to 11public WrappedDate(long date)
date
- milliseconds since January 1, 1970, 00:00:00 GMTMethod Detail |
public int getYear()
Calendar.get(Calendar.YEAR) - 1900
.
Calendar
public void setYear(int year)
Calendar.set(Calendar.YEAR, year + 1900)
.
year
- the year valueCalendar
public int getMonth()
Calendar.get(Calendar.MONTH)
.
0
and 11
, with the value
0
representing January.
Calendar
public void setMonth(int month)
Calendar.set(Calendar.MONTH, int month)
.
month
- the month value between 0-11Calendar
public int getDate()
Calendar.get(Calendar.DAY_OF_MONTH)
.
1
and 31
.
Calendar
public void setDate(int date)
Calendar.set(Calendar.DAY_OF_MONTH, int date)
.
date
- the day of the month value between 1-31Calendar
public int getDay()
Calendar.get(Calendar.DAY_OF_WEEK)
.
0
and 6
, where 0
represents Sunday.
Calendar
public long getTime()
public void setTime(long time)
public boolean before(Date when)
true
if the specified date represents any point in
time prior to 00:00:00.000 GMT on this date.
when
- a date
true
if this date is before the argument date;
false
otherwise.public boolean after(Date when)
true
if the specified date represents any point in
time after 23:59:59.999 GMT on this date.
when
- a date
true
if this date is after the argument date;
false
otherwise.public boolean equals(Object obj)
true
if and only if the argument is
not null
and is a java.util.Date
object
that represents any point in time between 00:00:00.000 and
23:59:59.999 GMT inclusive on the same date as this object.
obj
- the object to compare with
true
if the objects are the same;
false
otherwise.public static Date valueOf(String s)
s
- date in format "yyyy-mm-dd"
public String toString()
public int getTimezoneOffset()
Calendar.get(Calendar.ZONE_OFFSET) +
Calendar.get(Calendar.DST_OFFSET)
.
Calendar
,
TimeZone
private void writeObject(ObjectOutputStream s) throws IOException
IOException
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |