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
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
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。