获取年-月

import java.util.Date;



        LocalDate currentDate = LocalDate.now();
        YearMonth currentYearMonth = YearMonth.from(currentDate);
        String monthCurrent="";
        int year = currentYearMonth.getYear();
        int month = currentYearMonth.getMonthValue();
        if (month < 10) {
             monthCurrent="0"+ month;
        }else {
             monthCurrent= String.valueOf(month);
        }
        String term=year+"-"+monthCurrent;

你可能感兴趣的:(java,前端,javascript)