/**
* 获取当前时间的上月月份,格式: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();
}
获取当前时间的上月月份,格式:YYYY-MM-DD
最新推荐文章于 2024-07-20 03:25:00 发布