new Thread(
new Runnable() {
@Override
public void run() {
URL url;
try {
url =
new URL(imgBgLink);
HttpURLConnection conn =
(HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET"
);
conn.setConnectTimeout(5000
);
conn.connect();
long fileModifiedTime =
conn.getLastModified();//获取文件最后修改时间
//将Long型的时间转换为String SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//HH24小时制 java.util.Date dt = new Date(time);
String time=sdf.format(dt);
} catch (Exception e) {
e.printStackTrace();
}
}}).start();
转载于:https://www.cnblogs.com/carrieLee/p/4923954.html