java如何在Spring Boot中格式化时间戳字段?
我的实体中有timestamp
字段,我想将此字段格式化为dd.MM HH:mm:ss
我的实体:
@Entity
@Table(name = "payloads")
public class Payload {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@CreationTimestamp
@DateTimeFormat(pattern = "dd.MM HH:mm:ss")
@Column(name = "insert_date")
private Timestamp insertDate;
@Lob
private String value;
似乎@DateTimeFormat
不起作用,因为insert_date
列的格式是payloads
表中的yyyy-mm-dd hh:mm:ss
我的代码有什么问题?我如何解决这个问题
共 (0) 个答案