| java.lang.Object java.util.Date java.sql.Date
All known Subclasses: java.sql.Timestamp, java.sql.Time,
Date | public class Date extends java.util.Date (Code) | | A Date class which can consume and produce dates in SQL Date format.
The SQL date format represents a date as yyyy-mm-dd. Note that this date
format only deals with year, month and day values. There are no values for
hours, minutes, seconds.
This contrasts with regular java.util.Date values, which include time values
for hours, minutes, seconds, milliseconds.
Time points are handled as millisecond values - milliseconds since the epoch,
January 1st 1970, 00:00:00.000 GMT. Time values passed to the java.sql.Date
class are "normalized" to the time 00:00:00.000 GMT on the date implied by
the time value.
|
Constructor Summary | |
public | Date(int theYear, int theMonth, int theDay) Parameters: theYear - the year, specified as the year minus 1900. | public | Date(long theDate) Creates a Date which corresponds to the day implied by the supplied
theDate milliseconds time value.
Parameters: theDate - -a time value in milliseconds since the epoch - January 1 197000:00:00 GMT. |
Method Summary | |
public int | getHours() | public int | getMinutes() | public int | getSeconds() | public void | setHours(int theHours) | public void | setMinutes(int theMinutes) | public void | setSeconds(int theSeconds) | public void | setTime(long theTime) Sets this date to a date supplied as a milliseconds value. | public String | toString() | public static Date | valueOf(String dateString) Creates a Date from a string representation of a date in SQL format.
Parameters: dateString - the string representation of a date in SQL format -"yyyy-mm-dd". |
Date | public Date(int theYear, int theMonth, int theDay)(Code) | | Parameters: theYear - the year, specified as the year minus 1900. Must be in therange 0 to 8099. Parameters: theMonth - the month, specified as a number with 0 = January. Must be inthe range 0 to 11. Parameters: theDay - the day in the month. Must be in the range 1 to 31. |
Date | public Date(long theDate)(Code) | | Creates a Date which corresponds to the day implied by the supplied
theDate milliseconds time value.
Parameters: theDate - -a time value in milliseconds since the epoch - January 1 197000:00:00 GMT. The time value (hours, minutes, seconds,milliseconds) stored in the Date object is adjusted tocorrespond to 00:00:00 GMT on the day implied by the suppliedtime value. |
setHours | public void setHours(int theHours)(Code) | | Parameters: theHours - the number of hours to set throws: IllegalArgumentException - if this method is called |
setMinutes | public void setMinutes(int theMinutes)(Code) | | Parameters: theMinutes - the number of minutes to set throws: IllegalArgumentException - if this method is called |
setSeconds | public void setSeconds(int theSeconds)(Code) | | Parameters: theSeconds - the number of seconds to set throws: IllegalArgumentException - if this method is called |
setTime | public void setTime(long theTime)(Code) | | Sets this date to a date supplied as a milliseconds value. The date is
set based on the supplied time value after removing any time elements
finer than a day, based on zero GMT for that day.
Parameters: theTime - the time in milliseconds since the Epoch |
toString | public String toString()(Code) | | Produces a string representation of the Date in SQL format
a string representation of the Date in SQL format - "yyyy-mm-dd". |
valueOf | public static Date valueOf(String dateString)(Code) | | Creates a Date from a string representation of a date in SQL format.
Parameters: dateString - the string representation of a date in SQL format -"yyyy-mm-dd". the Date object throws: IllegalArgumentException - if the format of the supplied string does not match the SQLformat. |
|
|