Added in API level 1

Date

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

A thin wrapper around a millisecond value that allows JDBC to identify this as an SQL DATE value. A milliseconds value represents the number of milliseconds that have passed since January 1, 1970 00:00:00.000 GMT.

To conform with the definition of SQL DATE, the millisecond values wrapped by a java.sql.Date instance must be 'normalized' by setting the hours, minutes, seconds, and milliseconds to zero in the particular time zone with which the instance is associated.

Summary

Public constructors
Date(year: Int, month: Int, day: Int)

Constructs a Date object initialized with the given year, month, and day.

Date(date: Long)

Constructs a Date object using the given milliseconds time value.

Public methods
open Int

open Int

open Int

open Unit

open Unit

open Unit

open Unit
setTime(date: Long)

Sets an existing Date object using the given milliseconds time value.

open String

Formats a date in the date escape format yyyy-mm-dd.

open static Date!

Converts a string in JDBC date escape format to a Date value.

Inherited functions

Public constructors

Date

Added in API level 1
Date(
    year: Int,
    month: Int,
    day: Int)

Deprecated: instead use the constructor Date(long date)

Constructs a Date object initialized with the given year, month, and day.

The result is undefined if a given argument is out of bounds.

Parameters
year Int: the year minus 1900; must be 0 to 8099. (Note that 8099 is 9999 minus 1900.)
month Int: 0 to 11
day Int: 1 to 31

Date

Added in API level 1
Date(date: Long)

Constructs a Date object using the given milliseconds time value. If the given milliseconds value contains time information, the driver will set the time components to the time in the default time zone (the time zone of the Java virtual machine running the application) that corresponds to zero GMT.

Parameters
date Long: milliseconds since January 1, 1970, 00:00:00 GMT not to exceed the milliseconds representation for the year 8099. A negative number indicates the number of milliseconds before January 1, 1970, 00:00:00 GMT.

Public methods

getHours

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

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

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

See Also

getMinutes

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

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

Return
Int the number of minutes past the hour represented by this date.
Exceptions
java.lang.IllegalArgumentException if this method is invoked

See Also

getSeconds

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

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

Return
Int the number of seconds past the minute represented by this date.
Exceptions
java.lang.IllegalArgumentException if this method is invoked

See Also

setHours

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

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

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

See Also

setMinutes

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

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

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

See Also

setSeconds

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

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

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

See Also

setTime

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

Sets an existing Date object using the given milliseconds time value. If the given milliseconds value contains time information, the driver will set the time components to the time in the default time zone (the time zone of the Java virtual machine running the application) that corresponds to zero GMT.

Parameters
time the number of milliseconds.
date Long: milliseconds since January 1, 1970, 00:00:00 GMT not to exceed the milliseconds representation for the year 8099. A negative number indicates the number of milliseconds before January 1, 1970, 00:00:00 GMT.

toString

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

Formats a date in the date escape format yyyy-mm-dd.

Return
String a String in yyyy-mm-dd format

valueOf

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

Converts a string in JDBC date escape format to a Date value.

Parameters
s String!: a String object representing a date in in the format "yyyy-[m]m-[d]d". The leading zero for mm and dd may also be omitted.
Return
Date! a java.sql.Date object representing the given date
Exceptions
java.lang.IllegalArgumentException if the date given is not in the JDBC date escape format (yyyy-[m]m-[d]d)