URLConnection getDate Example
URLConnection class getDate example. This example shows you how to use getDate method.
URLConnection class getDate example. public long getDate() Returns the value of the date header field.
Here is the code
/*
* @ # GetDate.java
* A class repersenting use to GetDate
* method of URLConnection class in java.net package
* version 23 June 2008
* author Rose India
*/
import java.net.*;
public class GetDate {
public static void main(String args[]) throws Exception {
URL url = new URL("http://localhost:8080/net/index.jsp");
URLConnection connection = url.openConnection();
System.out.println("content-date " +
connection.getDate());
}
} |
Output
| content-date 1214393779000 |
|