Get modified date of web resource in Java
-
29-09-2019 - |
Question
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?
Solution
URL url = new URL(urlString);
URLConnection connection = url.openConnection();
connection.connect();
long time = connection.getLastModified();
Returns the value of the last-modified header field. The result is the number of milliseconds since January 1, 1970 GMT.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow