1.数据导出的时候
/*LocalDateTime要用DateTimeFormatter*/ DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); String format1 = format.format(starttime);
2.前台提交的时间,后台需要在实体类写注解
@DateTimeFormat(pattern = "yyyy-MM-dd") private LocalDate hpstartBegindate; @DateTimeFormat(pattern = "yyyy-MM-dd") private LocalDate hpstarEnddate; @DateTimeFormat(pattern = "HH:mm:ss") private LocalTime hpstarBegintime; @DateTimeFormat(pattern = "HH:mm:ss") private LocalTime hpstarEndtime; @DateTimeFormat(pattern = "yyyy-MM-dd") private LocalDate hpDisStarttime; @DateTimeFormat(pattern = "yyyy-MM-dd") private LocalDate hpDisEndtime;
不然后台接收不了数据,报500错误