//获取当前时间,年,月,日
// Date currentTime = new Date();
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
// String currentTimeString = formatter.format(currentTime);
String currentTimeString = parseDate(LocalDate.now(),"yyyy-MM-dd");
int curyear = Integer.valueOf(currentTimeString.split("-")[0]);
int curmonth = Integer.valueOf(currentTimeString.split("-")[1]);
int curday = Integer.valueOf(currentTimeString.split("-")[2]);
解析日期与时间
本文介绍了一种从当前日期中解析年、月、日的方法。通过使用本地日期对象和正则表达式,我们可以轻松地获取到具体的年份、月份和日期,为后续的数据处理和分析提供便利。

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



