Java Date Class
Java.util package provides a Date class which represents a specific instant in time, with millisecond precision.
The declaration of java.util.Date class is:
public class Date extends Object implements Serializable, Cloneable, Comparable<Date>
|S.N||Constructors & Description|
Allocates a Date object and initializes it so that it represents the time at which it was allocated, measured to the nearest millisecond.
Allocates a Date object 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.
The java.util.Date class has a number of methods which are listed below:
|S.N||Methods & Description|
boolean after(Date when)|
Tests if this date is after the specified date.
boolean before(Date when)|
Tests if this date is before the specified date.
Return a copy of this object.
int compareTo(Date anotherDate)|
Compares two Dates for ordering.
boolean equals(Object obj)|
Compares two dates for equality.
static Date from(Instant instant)|
Obtains an instance of Date from an Instant object.
Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.
Returns a hash code value for this object.
void setTime(long time)|
Sets this Date object to represent a point in time that is time milliseconds after January 1, 1970 00:00:00 GMT.
Converts this Date object to an Instant.
Returns this Date object to a String form.
This class inherits the methods of following class: