静态页面更新判别方法

来源:百度文库 编辑:神马文学网 时间:2024/06/03 11:19:14
HTTP Header 里面的 Last-modified 字段。也就是URLConnection的getLastModified()方法所得到的信息。
以下是通过long类型值获取日期类型:
long l=c.getLastModified();
String reString=new SimpleDateFormat("yyyy-MM-dd").format(new Date(l));    Date date=new Date(l);
一般正常返回为正确的修改时间,但有时候返回的可能是long值为0,这种情况下更新后也不会改变,不能以此作为判断更新的依据。