val now: Date = new Date();
val dateFormat: SimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
val dateNow = dateFormat.format(now);
val day =dateNow.substring(0,4)+dateNow.substring(5,7)+dateNow.substring(8,10);
val year=dateNow.substring(0,4).toInt;
val month=dateNow.substring(5,7).toInt;
val cal = Calendar.getInstance();
cal.set(Calendar.YEAR, year);
cal.set(Calendar.MONTH, month-2);
cal.set(Calendar.DAY_OF_MONTH,cal.getActualMaximum(Calendar.DATE));
new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime())
最后
以上就是凶狠楼房最近收集整理的关于scala获取上个月最后一天日期的全部内容,更多相关scala获取上个月最后一天日期内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复