Get modified date of web resource in Java

How do you get the modified date of a web resource in Java?

URL url = new URL(urlString);
URLConnection connection = url.openConnection();
connection.connect();
// What now?

Answers


URL url = new URL(urlString);
URLConnection connection = url.openConnection();
connection.connect();
long time = connection.getLastModified();

Javadoc

Returns the value of the last-modified header field. The result is the number of milliseconds since January 1, 1970 GMT.


Need Your Help

How to Create an XmlSchema instance from a String or an .xsd stored as a resource

xml xsd xml-validation

I have an .xsd file stored as a resource in my vb.net project. I need to create an instance of the XmlSchema class using this resource. Any examples of creating an XmlSchema I can locate do one...

UTF-8 to UCS-2 conversion with icu library

c++ unicode utf-8 icu ucs2

I'm currently working on and hitting an issue with converting a UTF-8 string to a UCS-2 string with the icu library. There are several number of ways to do this in the library, but so far none of ...