URLConnection: getDate() : URLConnection « javax.net « Java by API






URLConnection: getDate()

/*
 * Output:
 * 
Date: 1145919603000
Type: text/html
Exp: 0
Last M: 1143834458000
Length: 208546
 */


import java.net.URL;
import java.net.URLConnection;

public class MainClass {
  public static void main(String args[]) throws Exception {
    int c;
    URL hp = new URL("http", "www.java2s.com", 80, "/");
    URLConnection hpCon = hp.openConnection();
    System.out.println("Date: " + hpCon.getDate());
    System.out.println("Type: " + hpCon.getContentType());
    System.out.println("Exp: " + hpCon.getExpiration());
    System.out.println("Last M: " + hpCon.getLastModified());
    System.out.println("Length: " + hpCon.getContentLength());
  }
}
           
       








Related examples in the same category

1.URLConnection: getContentLength()
2.URLConnection: getContentType()
3.URLConnection: getExpiration()
4.URLConnection: getLastModified()
5.URLConnection: getInputStream()