URLConnection getHeaderFieldDate Example
URLConnection class getHeaderFieldDate example. This example shows you how to use getHeaderFieldDate method.
URLConnection class getHeaderFieldDate example. public long getHeaderFieldDate(String name, long Default) Returns the value of the named field parsed as date. The result is the number of milliseconds since January 1, 1970 GMT represented by the named field.
Here is the code
/*
* @ # GetHeaderFieldDate.java
* A class repersenting use to GetHeaderFieldDate
* method of URLConnection class in java.net package
* version 23 June 2008
* author Rose India
*/
import java.net.*;
public class GetHeaderFieldDate {
public static void main(String arhs[]) throws Exception {
SocketAddress socketAddress =
new InetSocketAddress("192.168.10.80", 9090);
Proxy proxy = new Proxy(Proxy.Type.HTTP, socketAddress);
URL url = new URL("http://roseindia.net");
URLConnection connection = url.openConnection(proxy);
System.out.println("Header Field Date " +
connection.getHeaderFieldDate("Date", 0));
}
} |
Output
| Header Field Date 1214564104000 |
|