Date (Java SE 26 & JDK 26)
- All Implemented Interfaces:
Serializable, Cloneable, Comparable<Date>
-
Constructor Summary
Constructors
Date()Allocates a
Dateobject and initializes it so that it represents the time at which it was allocated, measured to the nearest millisecond.Date(int year, int month, int date) Date(int year, int month, int date, int hrs, int min) Date(int year, int month, int date, int hrs, int min, int sec) Date(long date) Allocates a
Dateobject and initializes it to represent the specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT. -
Method Summary
booleanTests if this date is after the specified date.
booleanTests if this date is before the specified date.
clone()Return a copy of this object.
intCompares two Dates for ordering.
booleanCompares two dates for equality.
Obtains an instance of
Datefrom anInstantobject.intgetDate()intgetDay()intgetHours()intintgetMonth()intlonggetTime()Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this
Dateobject.intintgetYear()inthashCode()Returns a hash code value for this object.
static longvoidsetDate(int date) voidsetHours(int hours) voidsetMinutes(int minutes) voidsetMonth(int month) voidsetSeconds(int seconds) voidsetTime(long time) Sets this
Dateobject to represent a point in time that istimemilliseconds after January 1, 1970 00:00:00 GMT.voidsetYear(int year) Converts this
Dateobject to anInstant.toString()Converts this
Dateobject to aStringof the form:static longUTC(int year, int month, int date, int hrs, int min, int sec) Methods declared in class Object
finalize, getClass, notify, notifyAll, wait, wait, waitprotected voidDeprecated, for removal: This API element is subject to removal in a future version.
Returns the runtime class of this
Object.final voidWakes up a single thread that is waiting on this object's monitor.
final voidWakes up all threads that are waiting on this object's monitor.
final voidCauses the current thread to wait until it is awakened, typically by being notified or interrupted.
final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
Date
-
Date
-
Date
-
Date
-
Date
-
Date
-
-
Method Details
-
clone
-
UTC
-
parse
-
getYear
-
setYear
-
getMonth
-
setMonth
-
getDate
-
setDate
-
getDay
-
getHours
-
setHours
-
getMinutes
-
setMinutes
-
getSeconds
-
setSeconds
-
getTime
-
setTime
-
before
-
after
-
equals
-
compareTo
-
hashCode
-
toString
-
toLocaleString
-
toGMTString
-
getTimezoneOffset
-
from
-
toInstant
-