java.sql
Class Time

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.util.Date sample code for java.util.Date definition code for java.util.Date 
      extended by java.sql.Time
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable , Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable , Comparable sample code for java.lang.Comparable definition code for java.lang.Comparable <Date sample code for java.util.Date definition code for java.util.Date >

public class Time
extends Date sample code for java.util.Date definition code for java.util.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.

See Also:
Serialized Form

Constructor Summary
Time sample code for java.sql.Time.Time(int, int, int) definition code for java.sql.Time.Time(int, int, int) (int hour, int minute, int second)
          Deprecated. Use the constructor that takes a milliseconds value in place of this constructor
Time sample code for java.sql.Time.Time(long) definition code for java.sql.Time.Time(long) (long time)
          Constructs a Time object using a milliseconds time value.
 
Method Summary
 int getDate sample code for java.sql.Time.getDate() definition code for java.sql.Time.getDate() ()
          Deprecated.  
 int getDay sample code for java.sql.Time.getDay() definition code for java.sql.Time.getDay() ()
          Deprecated.  
 int getMonth sample code for java.sql.Time.getMonth() definition code for java.sql.Time.getMonth() ()
          Deprecated.  
 int getYear sample code for java.sql.Time.getYear() definition code for java.sql.Time.getYear() ()
          Deprecated.  
 void setDate sample code for java.sql.Time.setDate(int) definition code for java.sql.Time.setDate(int) (int i)
          Deprecated.  
 void setMonth sample code for java.sql.Time.setMonth(int) definition code for java.sql.Time.setMonth(int) (int i)
          Deprecated.  
 void setTime sample code for java.sql.Time.setTime(long) definition code for java.sql.Time.setTime(long) (long time)
          Sets a Time object using a milliseconds time value.
 void setYear sample code for java.sql.Time.setYear(int) definition code for java.sql.Time.setYear(int) (int i)
          Deprecated.  
 String sample code for java.lang.String definition code for java.lang.String toString sample code for java.sql.Time.toString() definition code for java.sql.Time.toString() ()
          Formats a time in JDBC time escape format.
static Time sample code for java.sql.Time definition code for java.sql.Time valueOf sample code for java.sql.Time.valueOf(java.lang.String) definition code for java.sql.Time.valueOf(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  s)
          Converts a string in JDBC time escape format to a Time value.
 
Methods inherited from class java.util.Date sample code for java.util.Date definition code for java.util.Date
after sample code for java.util.Date.after(java.util.Date) definition code for java.util.Date.after(java.util.Date) , before sample code for java.util.Date.before(java.util.Date) definition code for java.util.Date.before(java.util.Date) , clone sample code for java.util.Date.clone() definition code for java.util.Date.clone() , compareTo sample code for java.util.Date.compareTo(java.util.Date) definition code for java.util.Date.compareTo(java.util.Date) , equals sample code for java.util.Date.equals(java.lang.Object) definition code for java.util.Date.equals(java.lang.Object) , getHours sample code for java.util.Date.getHours() definition code for java.util.Date.getHours() , getMinutes sample code for java.util.Date.getMinutes() definition code for java.util.Date.getMinutes() , getSeconds sample code for java.util.Date.getSeconds() definition code for java.util.Date.getSeconds() , getTime sample code for java.util.Date.getTime() definition code for java.util.Date.getTime() , getTimezoneOffset sample code for java.util.Date.getTimezoneOffset() definition code for java.util.Date.getTimezoneOffset() , hashCode sample code for java.util.Date.hashCode() definition code for java.util.Date.hashCode() , parse sample code for java.util.Date.parse(java.lang.String) definition code for java.util.Date.parse(java.lang.String) , setHours sample code for java.util.Date.setHours(int) definition code for java.util.Date.setHours(int) , setMinutes sample code for java.util.Date.setMinutes(int) definition code for java.util.Date.setMinutes(int) , setSeconds sample code for java.util.Date.setSeconds(int) definition code for java.util.Date.setSeconds(int) , toGMTString sample code for java.util.Date.toGMTString() definition code for java.util.Date.toGMTString() , toLocaleString sample code for java.util.Date.toLocaleString() definition code for java.util.Date.toLocaleString() , UTC sample code for java.util.Date.UTC(int, int, int, int, int, int) definition code for java.util.Date.UTC(int, int, int, int, int, int)
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

Time sample code for java.sql.Time(int, int, int) definition code for java.sql.Time(int, int, int)

@Deprecated
public Time(int hour,
                       int minute,
                       int second)
Deprecated. Use the constructor that takes a milliseconds value in place of this constructor

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.

Parameters:
hour - 0 to 23
minute - 0 to 59
second - 0 to 59

Time sample code for java.sql.Time(long) definition code for java.sql.Time(long)

public Time(long time)
Constructs a Time object using a milliseconds time value.

Parameters:
time - milliseconds since January 1, 1970, 00:00:00 GMT; a negative number is milliseconds before January 1, 1970, 00:00:00 GMT
Method Detail

setTime sample code for java.sql.Time.setTime(long) definition code for java.sql.Time.setTime(long)

public void setTime(long time)
Sets a Time object using a milliseconds time value.

Overrides:
setTime sample code for java.util.Date.setTime(long) definition code for java.util.Date.setTime(long) in class Date sample code for java.util.Date definition code for java.util.Date
Parameters:
time - milliseconds since January 1, 1970, 00:00:00 GMT; a negative number is milliseconds before January 1, 1970, 00:00:00 GMT

valueOf sample code for java.sql.Time.valueOf(java.lang.String) definition code for java.sql.Time.valueOf(java.lang.String)

public static Time sample code for java.sql.Time definition code for java.sql.Time  valueOf(String sample code for java.lang.String definition code for java.lang.String  s)
Converts a string in JDBC time escape format to a Time value.

Parameters:
s - time in format "hh:mm:ss"
Returns:
a corresponding Time object

toString sample code for java.sql.Time.toString() definition code for java.sql.Time.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Formats a time in JDBC time escape format.

Overrides:
toString sample code for java.util.Date.toString() definition code for java.util.Date.toString() in class Date sample code for java.util.Date definition code for java.util.Date
Returns:
a String in hh:mm:ss format
See Also:
Date.toLocaleString() sample code for java.util.Date.toLocaleString() definition code for java.util.Date.toLocaleString() , Date.toGMTString() sample code for java.util.Date.toGMTString() definition code for java.util.Date.toGMTString()

getYear sample code for java.sql.Time.getYear() definition code for java.sql.Time.getYear()

@Deprecated
public int getYear()
Deprecated. 

This method is deprecated and should not be used because SQL TIME values do not have a year component.

Overrides:
getYear sample code for java.util.Date.getYear() definition code for java.util.Date.getYear() in class Date sample code for java.util.Date definition code for java.util.Date
Returns:
the year represented by this date, minus 1900.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if this method is invoked
See Also:
setYear(int) sample code for java.sql.Time.setYear(int) definition code for java.sql.Time.setYear(int)

getMonth sample code for java.sql.Time.getMonth() definition code for java.sql.Time.getMonth()

@Deprecated
public int getMonth()
Deprecated. 

This method is deprecated and should not be used because SQL TIME values do not have a month component.

Overrides:
getMonth sample code for java.util.Date.getMonth() definition code for java.util.Date.getMonth() in class Date sample code for java.util.Date definition code for java.util.Date
Returns:
the month represented by this date.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if this method is invoked
See Also:
setMonth(int) sample code for java.sql.Time.setMonth(int) definition code for java.sql.Time.setMonth(int)

getDay sample code for java.sql.Time.getDay() definition code for java.sql.Time.getDay()

@Deprecated
public int getDay()
Deprecated. 

This method is deprecated and should not be used because SQL TIME values do not have a day component.

Overrides:
getDay sample code for java.util.Date.getDay() definition code for java.util.Date.getDay() in class Date sample code for java.util.Date definition code for java.util.Date
Returns:
the day of the week represented by this date.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if this method is invoked
See Also:
Calendar sample code for java.util.Calendar definition code for java.util.Calendar

getDate sample code for java.sql.Time.getDate() definition code for java.sql.Time.getDate()

@Deprecated
public int getDate()
Deprecated. 

This method is deprecated and should not be used because SQL TIME values do not have a date component.

Overrides:
getDate sample code for java.util.Date.getDate() definition code for java.util.Date.getDate() in class Date sample code for java.util.Date definition code for java.util.Date
Returns:
the day of the month represented by this date.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if this method is invoked
See Also:
setDate(int) sample code for java.sql.Time.setDate(int) definition code for java.sql.Time.setDate(int)

setYear sample code for java.sql.Time.setYear(int) definition code for java.sql.Time.setYear(int)

@Deprecated
public void setYear(int i)
Deprecated. 

This method is deprecated and should not be used because SQL TIME values do not have a year component.

Overrides:
setYear sample code for java.util.Date.setYear(int) definition code for java.util.Date.setYear(int) in class Date sample code for java.util.Date definition code for java.util.Date
Parameters:
i - the year value.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if this method is invoked
See Also:
getYear() sample code for java.sql.Time.getYear() definition code for java.sql.Time.getYear()

setMonth sample code for java.sql.Time.setMonth(int) definition code for java.sql.Time.setMonth(int)

@Deprecated
public void setMonth(int i)
Deprecated. 

This method is deprecated and should not be used because SQL TIME values do not have a month component.

Overrides:
setMonth sample code for java.util.Date.setMonth(int) definition code for java.util.Date.setMonth(int) in class Date sample code for java.util.Date definition code for java.util.Date
Parameters:
i - the month value between 0-11.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if this method is invoked
See Also:
getMonth() sample code for java.sql.Time.getMonth() definition code for java.sql.Time.getMonth()

setDate sample code for java.sql.Time.setDate(int) definition code for java.sql.Time.setDate(int)

@Deprecated
public void setDate(int i)
Deprecated. 

This method is deprecated and should not be used because SQL TIME values do not have a date component.

Overrides:
setDate sample code for java.util.Date.setDate(int) definition code for java.util.Date.setDate(int) in class Date sample code for java.util.Date definition code for java.util.Date
Parameters:
i - the day of the month value between 1-31.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if this method is invoked
See Also:
getDate() sample code for java.sql.Time.getDate() definition code for java.sql.Time.getDate()