public class java.sql
Time


Hide details Login
Java SE 6
  
Extends: Date

A thin wrapper around the java.util.Date class that allows the JDBC API to identify this as an SQL TIME value. The Time class adds formatting and parsing operations to support the JDBC escape syntax for time values.

The date components should be set to the "zero epoch" value of January 1, 1970 and should not be accessed.


Constructors
public
Time(int hour, int minute, int second)

Constructs a Time object initialized with the given values for the hour, minute, and second. The driver sets the date components to January 1, 1970. Any method that attempts to access the date components of a Time object will throw a java.lang.IllegalArgumentException.

The result is undefined if a given argument is out of bounds.
hour0 to 23
minute0 to 59
second0 to 59
deprecatedUse the constructor that takes a milliseconds value in place of this constructor

public Time(long time)
Constructs a Time object using a milliseconds time value.
timemilliseconds since January 1, 1970, 00:00:00 GMT; a negative number is milliseconds before January 1, 1970, 00:00:00 GMT

Methods
public String toString()
Formats a time in JDBC time escape format.
returna String in hh:mm:ss format
public static Time valueOf(String s)
Converts a string in JDBC time escape format to a Time value.
stime in format "hh:mm:ss"
returna corresponding Time object

Properties
public void
setDate(int i)

This method is deprecated and should not be used because SQL TIME values do not have a date component.
deprecated
ThrowsIllegalArgumentException: if this method is invoked
See also getDate
public int
getDate()

This method is deprecated and should not be used because SQL TIME values do not have a date component.
deprecated
ThrowsIllegalArgumentException: if this method is invoked
See also setDate
public int
getDay()

This method is deprecated and should not be used because SQL TIME values do not have a day component.
deprecated
ThrowsIllegalArgumentException: if this method is invoked
public void
setMonth(int i)

This method is deprecated and should not be used because SQL TIME values do not have a month component.
deprecated
ThrowsIllegalArgumentException: if this method is invoked
See also getMonth
public int
getMonth()

This method is deprecated and should not be used because SQL TIME values do not have a month component.
deprecated
ThrowsIllegalArgumentException: if this method is invoked
See also setMonth
public void setTime(long time)
Sets a Time object using a milliseconds time value.
timemilliseconds since January 1, 1970, 00:00:00 GMT; a negative number is milliseconds before January 1, 1970, 00:00:00 GMT
public void
setYear(int i)

This method is deprecated and should not be used because SQL TIME values do not have a year component.
deprecated
ThrowsIllegalArgumentException: if this method is invoked
See also getYear
public int
getYear()

This method is deprecated and should not be used because SQL TIME values do not have a year component.
deprecated
ThrowsIllegalArgumentException: if this method is invoked
See also setYear