当前位置: 代码迷 >> 综合 >> Spring 将 LocalDateTime 格式转换为字符串给前端
  详细解决方案

Spring 将 LocalDateTime 格式转换为字符串给前端

热度:63   发布时间:2024-02-21 19:24:34.0

给字段加上以下注解 

@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")

 

  相关解决方案