Java tutorial
package com.devcraftsman.blog.post.api.util; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; import java.io.IOException; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; /** * Created by devcraftsman on 4/1/16. * ---------------------------------------------------- * This software is licensed under the Apache 2 license * see: [http://www.apache.org/licenses/LICENSE-2.0] **/ public class ISOLocalDateTimeSerializer extends JsonSerializer<LocalDateTime> { @Override public void serialize(LocalDateTime value, JsonGenerator gen, SerializerProvider serializers) throws IOException { if (value != null) { gen.writeString(value.format(DateTimeFormatter.ISO_DATE_TIME)); } } }