Gson使用中遇到的Timestamp格式问题
Gson gson = new GsonBuilder()
.registerTypeAdapter(Timestamp.class,new TimestampTypeAdapter())
.setDateFormat("yyyy-MM-dd HH:mm:ss")
.create();
String newValue = gson.toJson(System.currentTimeMillis());
Gson使用中遇到的Date格式问题
Gson gson = new GsonBuilder()
.setDateFormat("yyyy-MM-dd HH:mm:ss")
.create();
String newValue = gson.toJson(new Date(System.currentTimeMillis()),Date.class);