Get modified date of web resource in Java

2020-04-23 07:59发布

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条回答
聊天终结者
2楼-- · 2020-04-23 08:27
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.

查看更多
登录 后发表回答