Timestamp输出今天的后两天,忽略双休日

利用Calendar进行日期的操作然后转为Timestamp

 Calendar calendar = Calendar.getInstance();

    calendar.add(Calendar.DATE, 2);

    if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) {

        calendar.add(Calendar.DATE, 2);

    } else if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {

        calendar.add(Calendar.DATE, 1);

    }

    Timestamp startDate = new Timestamp(calendar.getTimeInMillis());

 

你可能感兴趣的:(Timestamp)