Hi,
I needed to find the last modified date of webpage. for that i used one code but that giving default date as output.solve my pbm.
here the code,
output:// Demonstrate URLConnection. import java.net.*; import java.io.*; import java.util.Date; class UCDemo { public static void main(String args[]) throws Exception { int c; URL hp = new URL("http", "www.google.com", 80, "/"); System.out.print(hp); URLConnection hpCon = hp.openConnection(); System.out.println("Date: " + new Date(hpCon.getDate())); System.out.println("Content-Type: " + hpCon.getContentType()); System.out.println("Expires: " + hpCon.getExpiration()); System.out.println("Last-Modified: " + new Date(hpCon.getLastModified())); int len = hpCon.getContentLength(); System.out.println("Content-Length: " + len); if (len > 0) { System.out.println("=== Content ==="); InputStream input = hpCon.getInputStream(); int i = len; while (((c = input.read()) != -1) && (-i > 0)) { System.out.print((char) c); } input.close(); } else { System.out.println("No Content Available"); } } }
Content-Type: null
Expires: 0
Last-Modified: Thu Jan 01 05:30:00 GMT+05:30 1970
Content-Length: -1
No Content Available