Finding Date of URL Connection using JAVA

The preceding Java code will show date of URL connection. 
  1. import java.net.HttpURLConnection;  
  2. import java.net.URL;  
  3. import java.util.Date;  
  4. public class Demo {  
  5.     public static void main(String args[])  
  6.     throws Exception {  
  7.         URL url = new URL("http://www.csharpcorner.com");  
  8.         HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();  
  9.         long date = httpCon.getDate();  
  10.         if (date == 0) System.out.println("No date information.");  
  11.         else System.out.println("Date: " + new Date(date));  
  12.     }  
  13. }  
Thank you, keep learning and sharing.