1.获取当前月1日
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM01");
String currentDate =sdf.format(date);
System.out.println("currentDate:"+currentDate); //输出当前月1日
本文介绍了一种使用Java编程语言获取当前月份第一天的具体方法。通过创建Date对象并结合SimpleDateFormat进行格式化处理,最终输出指定格式的日期字符串。
1.获取当前月1日
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM01");
String currentDate =sdf.format(date);
System.out.println("currentDate:"+currentDate); //输出当前月1日
788

被折叠的 条评论
为什么被折叠?