My server JSON is returning with two different type of DateFormat.
"MMM dd, yyyy" and "MMM dd, yyyy HH:mm:ss"
When I convert the JSON with the following it is fine:
Gson gson = new GsonBuilder().setDateFormat("MMM dd, yyyy").create();
But when I want the detailed date format and changed it to this, it throws exception com.google.gson.JsonSyntaxException: Mar 21, 2013
Gson gson = new GsonBuilder().setDateFormat("MMM dd, yyyy HH:mm:ss").create();
Is there a way for gson to handle two different DateFormat for its Json conversion?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…