远程服务器上文件的Last-Modified 格式化

来源:互联网 发布:windows.old怎么使用 编辑:程序博客网 时间:2024/05/31 19:16
URL urlA = new URL(url);HttpURLConnection urlcon = (HttpURLConnection) urlA.openConnection();String lastModified = urlcon.getHeaderField("Last-Modified");if(StringUtils.isNotBlank(lastModified)){    String format = "EEE, dd MMM yyyy HH:mm:ss zzz";    SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.US);    sdf.setTimeZone(TimeZone.getTimeZone("GMT"));     Date d = sdf.parse(lastModified); }