返回时间戳

springboot配置返回时间戳

2018年08月31日 11:14:47 z_k_h 阅读数:1448

版权声明:希望对你有所帮助 https://blog.csdn.net/z_k_h/article/details/82253530

springboot2.0后,spring会将时间自动给转成UTC字符串了 
springboot1.x版本的将date字段返回的是时间戳 
配置返回时间戳

spring
  jackson:
    serialization:
      write-dates-as-timestamps: true
  • 1
  • 2
  • 3
  • 4

这里写图片描述

全局配置返回字符串

spring:
    jackson:
        date-format: yyyy-MM-dd HH:mm:ss
        time-zone: GMT+8
  • 1
  • 2
  • 3
  • 4

这里写图片描述

猜你喜欢

转载自blog.csdn.net/qq_35568099/article/details/84883789