Added in API level 1

Time

open class Time : Date
kotlin.Any
   ↳ java.util.Date
   ↳ java.sql.Time

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.

Summary

Public constructors
Time(hour: Int, minute: Int, second: Int)

Constructs a Time object initialized with the given values for the hour, minute, and second.

Time(time: Long)

Constructs a Time object using a milliseconds time value.

Public methods
open Int

open Int

open Int

open Int

open Unit

open Unit

open Unit
setTime(time: Long)

Sets a Time object using a milliseconds time value.

open Unit

open String

Formats a time in JDBC time escape format.

open static Time!

Converts a string in JDBC time escape format to a Time value.

Inherited functions

Public constructors

Time

Added in API level 1
Time(
    hour: Int,
    minute: Int,
    second: Int)

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 Int: 0 to 23
minute Int: 0 to 59
second Int: 0 to 59

Time

Added in API level 1
Time(time: Long)

Constructs a Time object using a milliseconds time value.

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

Public methods

getDate

Added in API level 1
open fun getDate(): Int

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

Return
Int the day of the month represented by this date.
Exceptions
java.lang.IllegalArgumentException if this method is invoked

See Also

getDay

Added in API level 1
open fun getDay(): Int

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

Return
Int the day of the week represented by this date.
Exceptions
java.lang.IllegalArgumentException if this method is invoked

getMonth

Added in API level 1
open fun getMonth(): Int

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

Return
Int the month represented by this date.
Exceptions
java.lang.IllegalArgumentException if this method is invoked

See Also

getYear

Added in API level 1
open fun getYear(): Int

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

Return
Int the year represented by this date, minus 1900.
Exceptions
java.lang.IllegalArgumentException if this method is invoked

See Also

setDate

Added in API level 1
open fun setDate(i: Int): Unit

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

Parameters
date the day of the month value between 1-31.
Exceptions
java.lang.IllegalArgumentException if this method is invoked

See Also

setMonth

Added in API level 1
open fun setMonth(i: Int): Unit

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

Parameters
month the month value between 0-11.
Exceptions
java.lang.IllegalArgumentException if this method is invoked

See Also

setTime

Added in API level 1
open fun setTime(time: Long): Unit

Sets a Time object using a milliseconds time value.

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

setYear

Added in API level 1
open fun setYear(i: Int): Unit

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

Parameters
year the year value.
Exceptions
java.lang.IllegalArgumentException if this method is invoked

See Also

toString

Added in API level 1
open fun toString(): String

Formats a time in JDBC time escape format.

Return
String a String in hh:mm:ss format

valueOf

Added in API level 1
open static fun valueOf(s: String!): Time!

Converts a string in JDBC time escape format to a Time value.

Parameters
s String!: time in format "hh:mm:ss"
Return
Time! a corresponding Time object