Java 获取过去12个月日期

业务功能要求:查询前12个月的相关数据统计

	// 前 12个月日期
		LocalDate today = LocalDate.now();
        for(long i = 0L;i <= 11L; i++){
            LocalDate localDate = today.minusMonths(i);
            String month = localDate.toString().substring(0,7);
            System.out.println("month:" + month);
        }
发布了1266 篇原创文章 · 获赞 275 · 访问量 290万+

猜你喜欢

转载自blog.csdn.net/zhouzhiwengang/article/details/103787578
今日推荐