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刪除。