Skip to content

Instantly share code, notes, and snippets.

@tassioauad
Created November 17, 2016 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tassioauad/5c80b4b3f3d876c64193fd42ee8215b7 to your computer and use it in GitHub Desktop.
Save tassioauad/5c80b4b3f3d876c64193fd42ee8215b7 to your computer and use it in GitHub Desktop.
public class DateSerializer implements JsonSerializer {
@Override
public JsonElement serialize(Date date, Type typeOfSrc, JsonSerializationContext context) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
return context.serialize(formatter.format(date));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment