A thin wrapper around a millisecond value that allows
JDBC to identify this as an SQL DATE
value. A
milliseconds value represents the number of milliseconds that
have passed since January 1, 1970 00:00:00.000 GMT.
To conform with the definition of SQL DATE
, the
millisecond values wrapped by a java.sql.Date
instance
must be 'normalized' by setting the
hours, minutes, seconds, and milliseconds to zero in the particular
time zone with which the instance is associated.
Modifier and Type | Field and Description |
---|---|
pack-priv static final long | serialVersionUID
Private serial version unique ID to ensure serialization
compatibility.
|
Access | Constructor and Description |
---|---|
public | Date(int
the year minus 1900; must be 0 to 8099. (Note that
8099 is 9999 minus 1900.) year, int 0 to 11 month, int 1 to 31 day)
Deprecated
since 1.2. instead use the constructor
Date(long date)
Constructs a |
public | Date(long
milliseconds since January 1, 1970, 00:00:00 GMT not
to exceed the milliseconds representation for the year 8099.
A negative number indicates the number of milliseconds
before January 1, 1970, 00:00:00 GMT. date)Constructs a |
Modifier and Type | Method and Description |
---|---|
pack-priv static void | formatDecimalInt(int
Value to convert val, char[] Array containing converted value buf, int Starting pos in buf offset, int length of output value len)Formats an unsigned integer into a char array in decimal output format. |
public int | getHours()
Overrides java.
Deprecated
since 1.2.
This method is deprecated and should not be used because SQL Date values do not have a time component. |
public int | getMinutes()
Overrides java.
Deprecated
since 1.2.
This method is deprecated and should not be used because SQL Date values do not have a time component. |
public int | getSeconds()
Overrides java.
Deprecated
since 1.2.
This method is deprecated and should not be used because SQL Date values do not have a time component. |
public void | setHours(int
the hour value. i)Overrides java.
Deprecated
since 1.2.
This method is deprecated and should not be used because SQL Date values do not have a time component. |
public void | setMinutes(int
the value of the minutes. i)Overrides java.
Deprecated
since 1.2.
This method is deprecated and should not be used because SQL Date values do not have a time component. |
public void | setSeconds(int
the seconds value. i)Overrides java.
Deprecated
since 1.2.
This method is deprecated and should not be used because SQL Date values do not have a time component. |
public void | setTime(long
milliseconds since January 1, 1970, 00:00:00 GMT not
to exceed the milliseconds representation for the year 8099.
A negative number indicates the number of milliseconds
before January 1, 1970, 00:00:00 GMT. date)Overrides java. Sets an existing |
public Instant | toInstant()
Overrides java. This method always throws an UnsupportedOperationException and should
not be used because SQL |
public LocalDate | Returns: aLocalDate object representing the same date valueCreates a |
public String | Returns: a String in yyyy-mm-dd formatOverrides java. Formats a date in the date escape format yyyy-mm-dd. |
public static Date | |
public static Date |
serialVersionUID | back to summary |
---|---|
pack-priv static final long serialVersionUID Hides java. Private serial version unique ID to ensure serialization compatibility. |
Date | back to summary |
---|---|
public Date(int year, int month, int day)
Deprecated since 1.2. instead use the constructor Constructs a The result is undefined if a given argument is out of bounds.
|
Date | back to summary |
---|---|
public Date(long date) Constructs a
|
formatDecimalInt | back to summary |
---|---|
pack-priv static void formatDecimalInt(int val, char[] buf, int offset, int len) Formats an unsigned integer into a char array in decimal output format. Numbers will be zero-padded or truncated if the string representation of the integer is smaller than or exceeds len, respectively. Should consider moving this to Integer and expose it through JavaLangAccess similar to Integer::formatUnsignedInt
|
getHours | back to summary |
---|---|
public int getHours() Overrides java. Deprecated since 1.2.
This method is deprecated and should not be used because SQL Date values do not have a time component.
|
getMinutes | back to summary |
---|---|
public int getMinutes() Overrides java. Deprecated since 1.2.
This method is deprecated and should not be used because SQL Date values do not have a time component.
|
getSeconds | back to summary |
---|---|
public int getSeconds() Overrides java. Deprecated since 1.2.
This method is deprecated and should not be used because SQL Date values do not have a time component.
|
setHours | back to summary |
---|---|
public void setHours(int i) Overrides java. Deprecated since 1.2.
This method is deprecated and should not be used because SQL Date values do not have a time component.
|
setMinutes | back to summary |
---|---|
public void setMinutes(int i) Overrides java. Deprecated since 1.2.
This method is deprecated and should not be used because SQL Date values do not have a time component.
|
setSeconds | back to summary |
---|---|
public void setSeconds(int i) Overrides java. Deprecated since 1.2.
This method is deprecated and should not be used because SQL Date values do not have a time component.
|
setTime | back to summary |
---|---|
public void setTime(long date) Overrides java. Sets an existing
|
toInstant | back to summary |
---|---|
public Instant toInstant() Overrides java. This method always throws an UnsupportedOperationException and should
not be used because SQL
|
toLocalDate | back to summary |
---|---|
public LocalDate toLocalDate() Creates a
|
toString | back to summary |
---|---|
public String toString() Overrides java. Formats a date in the date escape format yyyy-mm-dd.
|
valueOf | back to summary |
---|---|
public static Date valueOf(String s) Converts a string in JDBC date escape format to
a
|
valueOf | back to summary |
---|---|
public static Date valueOf(LocalDate date) Obtains an instance of
The provided
|