datetimeformat和jsonformat的区别

时间:2024-10-01 19:29:04
package com.example.bryangp.web.entity; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @Data public class Student { private String name; @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss") private Date birth; @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date date; }