springboot:返回前端日期格式

1,312 阅读1分钟

1)springboot接口接收前端字符串类型日期 及 接口返回格式化日期

在对应的参数上注解:@DateTimeFormat

2)springboot返回前端日期格式,可以采用两种方式,如下:

1.在配置文件中,做一个全局的配置

spring.jackson.date-format=yyyy-MM-dd HH:mm:ss

  date-format: yyyy-MM-dd HH:mm:ss
  time-zone: GMT+8

2.在对应的实体类或者vo要返回给前端的属性上加

@JsonFormat(timezone = "GMT+8", pattern = "HH:mm")

www.cnblogs.com/guoyuchuan/…