Created
November 17, 2016 12:25
-
-
Save tassioauad/a23474ca2f74a4f93f6cb7ce7f459a59 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DateDeserializer implements JsonDeserializer { | |
@Override | |
public Date deserialize(JsonElement element, Type arg1, JsonDeserializationContext arg2) throws JsonParseException { | |
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); | |
try { | |
return formatter.parse(element.getAsString()); | |
} catch (ParseException e) { | |
return null; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment