Java Date clone() Method22 Mar 2025 | 1 min read The clone() method of Java Date class returns a copy/clone of this object. This method overrides clone in class Object. Syntax:ParametersNA ReturnIt returns a clone/copy of this instance. Example 1Output: Clone of your Date 'd' : Mon Oct 21 00:00:00 IST 3918 Example 2Output: Clone of your Date 'd' : Sat Apr 10 00:00:00 IST 3897 Next Topicjava.util.Date |
Java Date Method The method of Java Date class tests whether the date is before the specified date or not. Syntax: public boolean before(Date when) Parameters when - a date Return It returns a Boolean value. It will return true if this date is before the specified date otherwise false. Exception NullPointerException...
1 min read
Java Date Method The method of Java Date class converts this date object into an Instant, and it returns an instant representing the same point on the tim-line as the date object. Syntax: public Instant Parameters NA Return It returns an instant representing the same point on time-line as...
1 min read
Java Date UTC Method The UTC method of Java Date class determines the date and time. These are determined by arguments which are interpreted as a year, month, day of the month, an hour of the day. This method is deprecated as of JDK version 1.1 it...
1 min read
Java Date Method The method of Java Date class returns the value between 1 to 31 which represents the day of the month by this date object. This method is deprecated as of JDK version 1.1 and replaced by Calender.get(Calender.DAY_OF_MONTH) Syntax: @Deprecated public int Parameters NA Return It returns the...
1 min read
Java Date Method The method of Java Date class converts this date object into a String in implementation-dependent form. This method is deprecated as of JDK version 1.1. It is replaced by DateFormat.format(Date date). Syntax: Syntax @Deprecated public String Parameters NA Return The returns a String representing this date object by...
1 min read
Java Date Method The method of Java Date class compares two dates and sort them for order. This method is specified by compareTo in interface Comparable<Date>. Syntax: public int compareTo(Date anotherDate) Parameters anotherDate - a date to be compared Return It returns the value 0 if the argument Date is...
1 min read
Java Date Method The method of Java Date class converts this date object into a String in form "d mon yyyy hh:mm:ss GMT". This method is deprecated as of JDK version 1.1 and by using GTMTimeZone it is replaced by DateFormat.format(Date date) Syntax: @Deprecated public String Parameters NA Return The ...
1 min read
Java Date Method The method of Java Date class returns a value which is a hash code for this object. This method overrides hashCode in class Object. Syntax: public int Parameters NA Return It returns a hashCode value for this object. Example 1 import java.util.Date; public class JavaDateHashCodeExample1 { public static void main(String[]...
1 min read
Java Date Method The method of Java Date class sets the minutes of the hour of this date object to the given value. It changes the ious minutes of the hour value to the newly specified value. This method is deprecated as of JDK version...
1 min read
Java Date Method The method of java date class returns the value between 0 to 6 which represents the day of the week by this date object. Value Day 0 Sunday 1 Monday 2 Tuesday 3 Wednesday 4 Thursday 5 Friday 6 Saturday This method is deprecated as of JDK version 1.1 and replaced by Calender.get(Calender.DAY_OF_WEEK) Syntax: @Deprecated public int Parameters NA Return It returns the day...
1 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India