HttpURLConnection class is the class in java which deals with all the operations related to URL connection. getDate() method of HttpURLConnection class is the method that is used to get the date and time of the URL Connection.
Obj.getDate() // Obj is object of HttpUrlConnection class
Parameter: This method does not take any parameter. It is just used along with a HttpUrlConnection Object from which we want to fetch the date and time of the connection.
Return values: It returns the day, date and time of connection.
Below is the code implementation to get the date of the URL connection.
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.