Google的Gson功能非常强大!

格式化日期我们只需要这样创建就好了

Gson  gson = new GsonBuilder().setDateFormat("yyyy-MM-dd hh:mm:ss).create();

System.out.print(gson.toJson(new Date()));

常见日期格式:

  yyyy-MM-dd

  yyyy-MM-dd hh:mm:ss

  MM-dd-yyyy hh:mm

相关文章:

  • 2022-12-23
  • 2022-01-06
  • 2021-12-22
  • 2021-06-19
  • 2021-08-20
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-16
  • 2022-12-23
相关资源
相似解决方案