title: Serialization for Java Calendar
body: <p>How do I create a custom serialization for java Calendar to json by extending json <code>serializer&lt;Calendar&gt;</code>?</p>
  
  <p>I tried the same for <code>java.until.Date</code> and it's working. In the serialization method, I converted Date as String and write it in json format.</p>
  
  <p>The sample code done for java.util.Date is similar to code given below</p>
  
  <pre><code>  public class CDJsonDateSerializer extends JsonSerializer&lt;Date&gt;{
    @Override
    public void serialize(Date date, JsonGenerator jsonGenerator,SerializerProvider provider)
   throws IOException {
  
        SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
        String dateString = dateFormat.format(date);
       jsonGenerator.writeString(dateString);
   }
  }
  </code></pre>
  
  <p>And it is used like so:</p>
  
  <pre><code> @JsonSerialize(using = CDJsonDateSerializer.class)
   private Date startDate;
  </code></pre>
  
  <p>What can I do for Serialize Calendar in java to json without losing data in Calendar object ? </p>