欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

SpringBoot——String字符串格式化为LocalDate

程序员文章站 2022-03-23 23:22:03
...
 @PostMapping("/edit")
    public String edit(Long id, String name, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate birthday) {

        System.out.println(birthday);
        Customer customer = customerService.getById(id);
        customer.setBirthday(birthday);
        customer.setName(name);
        boolean b = customerService.updateById(customer);
        if (b) {
            return "redirect:/customer/list";
        }
        return null;
    }
相关标签: SpringBoot学习