获取前一天时间

来源:互联网 发布:查看80端口占用情况 编辑:程序博客网 时间:2024/05/05 03:51
Date date = new Date();        Calendar calendar = Calendar.getInstance();        calendar.setTime(date);        calendar.add(Calendar.DAY_OF_MONTH, -1);        Date beforeDate = calendar.getTime();// 结果        SimpleDateFormat df = new SimpleDateFormat("yyyy.MM.dd");        String time = df.format(beforeDate);        return time;
0 0