public class Time extends Date
TIME
value. Provides utilities to
format and parse the time's representation as a String in JDBC escape format.Constructor and Description |
---|
Time(int theHour,
int theMinute,
int theSecond)
Deprecated.
Use the constructor
Time(long) . |
Time(long theTime)
Constructs a
Time object using a supplied time specified in
milliseconds. |
Modifier and Type | Method and Description |
---|---|
int |
getDate()
Deprecated.
This method is deprecated and must not be used. An SQL
Time object does not have a Date component. |
int |
getDay()
Deprecated.
This method is deprecated and must not be used. An SQL
Time object does not have a Day component. |
int |
getMonth()
Deprecated.
This method is deprecated and must not be used. An SQL
Time object does not have a Month component. |
int |
getYear()
Deprecated.
This method is deprecated and must not be used. An SQL
Time object does not have a Year component. |
void |
setDate(int i)
Deprecated.
This method is deprecated and must not be used. An SQL
Time object does not have a Date component. |
void |
setMonth(int i)
Deprecated.
This method is deprecated and must not be used. An SQL
Time object does not have a Month component. |
void |
setTime(long time)
Sets the time for this
Time object to the supplied milliseconds
value. |
void |
setYear(int i)
Deprecated.
This method is deprecated and must not be used. An SQL
Time object does not have a Year component. |
String |
toString()
Formats the
Time as a String in JDBC escape format: hh:mm:ss . |
static Time |
valueOf(String timeString)
Creates a
Time object from a string holding a time represented in
JDBC escape format: hh:mm:ss . |
after, before, clone, compareTo, equals, getHours, getMinutes, getSeconds, getTime, getTimezoneOffset, hashCode, parse, setHours, setMinutes, setSeconds, toGMTString, toLocaleString, UTC
@Deprecated public Time(int theHour, int theMinute, int theSecond)
Time(long)
.Time
object using the supplied values for Hour,
Minute and Second. The Year, Month and
Day elements of the Time
object are set to the date
of the Epoch (January 1, 1970).
Any attempt to access the Year, Month or Day
elements of a Time
object will result in an IllegalArgumentException
.
The result is undefined if any argument is out of bounds.
theHour
- a value in the range [0,23]
.theMinute
- a value in the range [0,59]
.theSecond
- a value in the range [0,59]
.public Time(long theTime)
Time
object using a supplied time specified in
milliseconds.theTime
- a Time
specified in milliseconds since the
Epoch (January 1st 1970, 00:00:00.000).@Deprecated public int getDate()
Time
object does not have a Date
component.Date
Date
object.getDate
in class Date
IllegalArgumentException
- if this method is called.@Deprecated public int getDay()
Time
object does not have a Day component.Date
Date
object.getDay
in class Date
IllegalArgumentException
- if this method is called.@Deprecated public int getMonth()
Time
object does not have a Month component.Date
Date
object.getMonth
in class Date
IllegalArgumentException
- if this method is called.@Deprecated public int getYear()
Time
object does not have a Year component.Date
Date
object.getYear
in class Date
IllegalArgumentException
- if this method is called.@Deprecated public void setDate(int i)
Time
object does not have a Date
component.Date
Date
object.setDate
in class Date
i
- the day of the month.IllegalArgumentException
- if this method is called.@Deprecated public void setMonth(int i)
Time
object does not have a Month component.Date
Date
object.setMonth
in class Date
i
- the month.IllegalArgumentException
- if this method is called.@Deprecated public void setYear(int i)
Time
object does not have a Year component.Date
Date
object.setYear
in class Date
i
- the year since 1900.IllegalArgumentException
- if this method is called.public void setTime(long time)
Time
object to the supplied milliseconds
value.public String toString()
Time
as a String in JDBC escape format: hh:mm:ss
.public static Time valueOf(String timeString)
Time
object from a string holding a time represented in
JDBC escape format: hh:mm:ss
.
An exception occurs if the input string does not comply with this format.
timeString
- A String representing the time value in JDBC escape format:
hh:mm:ss
.Time
object set to a time corresponding to the given
time.IllegalArgumentException
- if the supplied time string is not in JDBC escape format.