[英]How to parse string to Date object using Gson, with original string format
The string format is yyyy-MM-dd HH:mm
, for example 2017-01-01 10:30
. 字符串格式为
yyyy-MM-dd HH:mm
,例如2017-01-01 10:30
。
How to parse the string to date using Gson? 如何使用Gson解析字符串至今?
Create Gson Object and pass Date format like this, 创建Gson对象并像这样传递日期格式,
Gson gson = new GsonBuilder().setDateFormat(YOUR_DATE_FORMAT).create();
Hope this may help you. 希望这对您有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.