得到当前时间的代码:
getNowTime() {
var now = new Date();
var year = now.getFullYear(); //得到年份
var month = now.getMonth(); //得到月份
var day = now.getDate(); //得到天
if (day < 10) {
day = "0" + day
}
month = month + 1;
month = month.toString().padStart(2, "0");
return `${year}-${month}-${day}`
},
注意:实体类前要加注释
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate startTime;