How to Handle Date Time values in Spring MVC

Convert String to Date Time from Request Query String, payload of x-www-urlencoded or form-data

@GetMapping("testDateTime1")
public String testDateTime(@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date dateTime) {
...
}
@RequestMapping("testDateTime2")
public String testDateTime2(QueryVo queryVo) {
...
}
public class QueryVo {
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date dateTime;
}

Convert String to Date Time from Request payload of application/json

@PostMapping("testDateTime3")
public String testDateTime3(@RequestBody QueryVo queryVo) {
System.out.println("testDateTime");
return queryVo.toString();
}

public class QueryVo {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date dateTime;
}