The following example demonstrates how to view the last modification time of the file specified by the host:
/* author by w3cschool.cc Main.java */import java.net.URL;import java.net.URLConnection;public class Main { public static void main(String[] argv) throws Exception { URL u = new URL("http://127.0.0.1/java.bmp"); URLConnection uc = u.openConnection(); uc.setUseCaches(false); long timestamp = uc.getLastModified(); System.out.println("java.bmp 文件最后修改时间 :"+timestamp); }}
The output result of running the above code is:
java.bmp 文件最后修改时间 24 May 2014 12:14:50
The above is the Java example - View The content of the last modification time of the file specified by the host. For more related content, please pay attention to the PHP Chinese website (m.sbmmt.com)!