小轩窗i
给时光以生命,而不是给生命以时光。 ——小菜鸟的飞行日记
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();

 

posted on 2015-10-30 17:46  小轩窗i  阅读(867)  评论(0编辑  收藏  举报