Get modified date of web resource in Java

前端 未结 1 1311
南笙
南笙 2021-01-24 17:02

How do you get the modified date of a web resource in Java?

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


        
相关标签:
1条回答
  • 2021-01-24 17:32
    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.

    0 讨论(0)
提交回复
热议问题