content: package com.alibaba.excel.converters.localdate;
  
  import java.time.LocalDate;
  import java.time.LocalDateTime;
  
  import com.alibaba.excel.converters.Converter;
  import com.alibaba.excel.metadata.GlobalConfiguration;
  import com.alibaba.excel.metadata.data.WriteCellData;
  import com.alibaba.excel.metadata.property.ExcelContentProperty;
  import com.alibaba.excel.util.DateUtils;
  import com.alibaba.excel.util.WorkBookUtil;
  
  /**
   * LocalDate and date converter
   *
   * @author Jiaju Zhuang
   */
  public class LocalDateDateConverter implements Converter<LocalDate> {
      @Override
      public Class<?> supportJavaTypeKey() {
          return LocalDate.class;
      }
  
      @Override
      public WriteCellData<?> convertToExcelData(LocalDate value, ExcelContentProperty contentProperty,
          GlobalConfiguration globalConfiguration) throws Exception {
          LocalDateTime localDateTime = value == null ? null : value.atTime(0, 0);
          WriteCellData<?> cellData = new WriteCellData<>(localDateTime);
          String format = null;
          if (contentProperty != null && contentProperty.getDateTimeFormatProperty() != null) {
              format = contentProperty.getDateTimeFormatProperty().getFormat();
          }
          WorkBookUtil.fillDataFormat(cellData, format, DateUtils.defaultLocalDateFormat);
          return cellData;
      }
  }
  