The java.util.GregorianCalendar.hashCode() is an in-built function in Java which generates hash code for this GregorianCalendar instance.
public int hashCode()
Parameters: This function does not accept any parameters.
Return Values: This function returns an integer value which represents the hash code for this GregorianCalendar instance.
Input : Thu Jul 24 00:53:29 UTC 1997 Output : 2121703905 Input : Tue Jul 24 00:54:11 UTC 2018 Output : -909136554
Below programs illustrate the java.util.GregorianCalendar.hashCode() function:
Current Date and Time : Fri Jul 27 11:43:16 UTC 2018 Hash Code:-612105832
Current Date and Time : Fri Jul 27 11:43:18 UTC 2018 Modified Date and Time : Thu Jul 27 11:43:18 UTC 2006 Hash Code of the modified date and time:-1346149059
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.