Get modified date of web resource in Java

橙三吉。 提交于 2019-12-20 04:19:31

问题


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?

回答1:


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.



来源:https://stackoverflow.com/questions/3095775/get-modified-date-of-web-resource-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!