首页 > TAG信息列表 > threeDayAgo

Java 获取三天前时间

(1)根据new Date().getTime()获取从1970年1月1日0点0分到目前的毫秒数计算三天前的时间:    Date dateBy3Days = new Date(new Date().getTime()-3*24*60*60*1000);   SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");   String threeDayAgo = sdf.format(dateBy3D