/**
* @Author laixiaoxing
* @Description //获取当前时间的上一个月底的时间
* @Date 上午1:57 2019/1/27
*/
private Date getLastMonthFinallyDate(Date begin) {
Instant instant = begin.toInstant();
ZoneId zoneId = ZoneId.systemDefault();
//当前月份日期
LocalDateTime LocalBegin = instant.atZone(zoneId).toLocalDateTime();
//上个月的日期
LocalDateTime localDateLast = LocalBegin.minusMonths(1);
//上个月最后一天的日期
LocalDateTime lastDay = localDateLast.withDayOfMonth(localDateLast.toLocalDate().lengthOfMonth());
ZonedDateTime zdt = lastDay.atZone(zoneId);
return Date.from(zdt.toInstant());
}
java 获取某年最后一个月 java获取上个月的月末日期
转载文章标签 java 获取某年最后一个月 获取当前时间 文章分类 Java 后端开发
本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
java 如何获取一个空的DATE对象
java 如何获取一个空的DATE对象
java System Java -
java获取当月最大日
java获取当月最大日
System java 字段