站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v1.1.8, Java 2 SDK 英文文档

Class java.sql.Time - JDK 5 Documentation v1.1.8, Java 2 SDK 英文文档

All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.sql.Time

java.lang.Object
   |
   +----java.util.Date
           |
           +----java.sql.Time

public class Time
extends Date

This class is a thin wrapper around java.util.Date that allows JDBC to identify this as a SQL TIME value. It adds formatting and parsing operations to support the JDBC escape syntax for time values.


Constructor Index

 o Time(int, int, int)
Construct a Time Object
 o Time(long)
Construct a Time using a milliseconds time value

Method Index

 o getDate()
Returns the day of the month represented by this date.
 o getDay()
Returns the day of the week represented by this date.
 o getMonth()
Returns the month represented by this date.
 o getYear()
Returns the year represented by this date, minus 1900.
 o setDate(int)
Sets the day of the month of this date to the specified value.
 o setMonth(int)
Sets the month of this date to the specified value.
 o setTime(long)
Set a Time using a milliseconds time value
 o setYear(int)
Sets the year of this date to be the specified value plus 1900.
 o toString()
Format a time in JDBC date escape format
 o valueOf(String)
Convert a string in JDBC time escape format to a Time value

Constructors

 o Time
 public Time(int hour,
             int minute,
             int second)
Construct a Time Object

Parameters:
hour - 0 to 23
minute - 0 to 59
second - 0 to 59
 o Time
 public Time(long time)
Construct a Time using a milliseconds time value

Parameters:
time - milliseconds since January 1, 1970, 00:00:00 GMT

Methods

 o setTime
 public void setTime(long time)
Set a Time using a milliseconds time value

Parameters:
time - milliseconds since January 1, 1970, 00:00:00 GMT
Overrides:
setTime in class Date
 o valueOf
 public static Time valueOf(String s)
Convert a string in JDBC time escape format to a Time value

Parameters:
s - time in format "hh:mm:ss"
Returns:
corresponding Time
 o toString
 public String toString()
Format a time in JDBC date escape format

Returns:
a String in hh:mm:ss format
Overrides:
toString in class Date
 o getYear
 public int getYear()
Returns the year represented by this date, minus 1900.

Overrides:
getYear in class Date
 o getMonth
 public int getMonth()
Returns the month represented by this date.

Overrides:
getMonth in class Date
 o getDay
 public int getDay()
Returns the day of the week represented by this date.

Overrides:
getDay in class Date
 o getDate
 public int getDate()
Returns the day of the month represented by this date.

Overrides:
getDate in class Date
 o setYear
 public void setYear(int i)
Sets the year of this date to be the specified value plus 1900.

Overrides:
setYear in class Date
 o setMonth
 public void setMonth(int i)
Sets the month of this date to the specified value.

Overrides:
setMonth in class Date
 o setDate
 public void setDate(int i)
Sets the day of the month of this date to the specified value.

Overrides:
setDate in class Date

All Packages  Class Hierarchy  This Package  Previous  Next  Index

Submit a bug or feature - Version 1.1.8 of Java Platform API Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1995-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.