在Java中获取Web资源的修改日期 [英] Get modified date of web resource in Java

查看:145
本文介绍了在Java中获取Web资源的修改日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Java中获取Web资源的修改日期?

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?


推荐答案

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

Javadoc


返回最后修改的
头字段的值。结果是1970年1月1日以来的毫秒数

GMT。

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

这篇关于在Java中获取Web资源的修改日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆