//解析日期
String dateStr= "2018年12月18日";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日");
LocalDate date= LocalDate.parse(dateStr, formatter);
//日期转换为字符串
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy年MM月dd日 hh:mm a");
String nowStr = now .format(format);
System.out.println(nowStr);
kotlin 判断是否是今天;Date 转LocalDateTime
fun Date.isToday(): Boolean {
val now = LocalDateTime.now()
val format = DateTimeFormatter.ofPattern("yyyy-MM-dd")
val ldt = LocalDateTime.ofInstant(this.toInstant(), ZoneId.systemDefault())
return ldt.format(format) == now.format(format)
}