Java获取N天前,N天后的日期(如3天)

时间:2025-03-10 07:56:53
    /**
     *
     * @param num ﹣3 三天前 +3 三天后
     * @return
     */
    public static String getDayAgoOrAfterString(int num){
        Calendar calendar1 = ();
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
        (, num);
/*
        Calendar calendar1 = ();
        (, 59);
        (, 59);
        (Calendar.HOUR_OF_DAY, 23);
        (, 999);
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        (, num);
*/
        return (());
    }