获取日期可设置月份和年份

public static final String getDate1() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DAY_OF_MONTH, 12);
        calendar.set(Calendar.DAY_OF_MONTH, 2);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND,0);
        Date beforeDate = calendar.getTime();
        String time = sdf.format(beforeDate);
        return time;
    }
上一篇:Codeforces Round #674 (Div. 3) D. Non-zero Segments(前缀和/尺取)垃圾做法


下一篇:[CF620F]Xors on Segments