gpt4 book ai didi

java - 在Java中获取网络资源的修改日期

转载 作者:行者123 更新时间:2023-11-29 08:17:50 25 4
gpt4 key购买 nike

如何在 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

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

关于java - 在Java中获取网络资源的修改日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3095775/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com