HttpURLConnection GetHeaderFieldDate() Example
Returns the value of the named field parsed as date
HttpURLConnectionclass GetHeaderFieldDate() method example. This example shows you how to use GetHeaderFieldDate() method.This method Returns the value of the named field parsed as date
Here is the code:-
/*
* @Program that Returns the value of the field, parsed as a date.
* GetHeaderFieldDate.java
* Author:-RoseIndia Team
* Date:-25-Jun-2008
*/
import java.io.*;
import java.net.*;
public class GetHeaderFieldDate {
public static void main(String[] args) throws Exception {
URL url = new URL("http://192.168.10.211:8080");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
//Returns the value of the field, parsed as a date.
long lastModified = connection.getHeaderFieldDate("last-modification", 0);
System.out.println("Value of the field parsed as a date is : "+lastModified);
}
} |
Output of the program:-
| Value of the field parsed as a date is : 0 |
|