/**
* 获取当前时间的上月月份,格式:YYYY-MM-DD
* */
public static String getMonth(){
LocalDate now=LocalDate.now();
int month=now.getMonthValue();
int lastmonth=month==1?12:month-1;
int year=month==1?now.getYear()-1:now.getYear();
LocalDate last=now.withYear(year);
last=last.withMonth(lastmonth);
return last.toString();
}
转载请注明原文地址:https://ipadbbs.8miu.com/read-11803.html