Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

Copyright © 2006 Sun Microsystems, Inc. All rights reserved.

JDBC for CDC/FP Optional Package

java.sql
Class Time

java.lang.Object
  |
  +--java.util.Date
        |
        +--java.sql.Time
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, java.io.Serializable

public class Time
extends 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(long time)
          Constructs a Time object using a milliseconds time value.
 
Method Summary
 void setTime(long time)
          Sets a Time object using a milliseconds time value.
 java.lang.String toString()
          Formats a time in JDBC time escape format.
static Time valueOf(java.lang.String s)
          Converts a string in JDBC time escape format to a Time value.
 
Methods inherited from class java.util.Date
after, before, clone, compareTo, compareTo, equals, getTime, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Time

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

public void setTime(long time)
Sets a Time object using a milliseconds time value.
Overrides:
setTime in class 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

public static Time valueOf(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

public java.lang.String toString()
Formats a time in JDBC time escape format.
Overrides:
toString in class java.util.Date
Returns:
a String in hh:mm:ss format

JDBC for CDC/FP Optional Package

Copyright © 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

For more information, please consult the JSR 169 specification.