Skip to content

Tag Archives: Java-util-Date

The toInstant() method of Date class in Java is used to convert a Date object to an Instant object. An Instant is created during the… Read More
The from(Instant inst) method of Java Date class returns an instance of date which is obtained from an Instant object. Syntax: public static Date from(Instant… Read More
The clone() method of Date class in Java returns the duplicate of the passed Date object. This duplicate is just a shallow copy of the… Read More
The setTime() method of Java Date class sets a date object. It sets date object to represent time milliseconds after January 1, 1970 00:00:00 GMT.… Read More
The hashCode() method of Java Date class returns a value which is a hash code for this object. Syntax: public int hashCode() Parameters: The function… Read More
The getTime() method of Java Date class returns the number of milliseconds since January 1, 1970, 00:00:00 GTM which is represented by Date object. Syntax:… Read More
The toString() method of Java Date class converts this date object into a String in form “dow mon dd hh:mm:ss zzz yyy”. This method overrides… Read More
The equals() method of Java Date class checks if two Dates are equal, based on millisecond difference. Syntax: public boolean equals(Object obj) Parameters: The function… Read More
The compareTo() method of Java Date class compares two dates and sort them for order. Syntax: public int compareTo(Date anotherDate) Parameters: The function accepts a… Read More
The before() method of Java Date class tests whether the date is before the specified date or not. Syntax: public boolean before(Date when) Parameters: The… Read More
The java.util.Date.after() method is used to check whether the current instance of the date is after the specified date. Syntax: dateObject.after(Date specifiedDate) Parameter: It takes… Read More
Following are some important date class methods : .toString() : java.util.Date.tostring() method is a java.util.Date class method.It displays the Current date and time. Here Date… Read More
The class Date represents a specific instant in time, with millisecond precision. The Date class of java.util package implements Serializable, Cloneable and Comparable interface. It… Read More

Start Your Coding Journey Now!