title: How convert OffsetDateTime with open csv 5.0
body: <p>I am using open csv 5.0</p>
  <p>to be able to read the data imported from a csv file</p>
  <p>I am facing a problem regarding</p>
  <p>the conversion of a DateOffsetDateTime format.</p>
  <p>here my code :</p>
  <p>the model :</p>
  <pre><code>import com.opencsv.bean.CsvBindByName;
  import lombok.AllArgsConstructor;
  import lombok.Getter;
  import lombok.NoArgsConstructor;
  import lombok.Setter;
  
  import java.time.OffsetDateTime;
  
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public class IndProdCsv {
  
      @CsvBindByName
      private Long id;
      @CsvBindByName
      private String service;
      @CsvBindByName
      private OffsetDateTime time;
      @CsvBindByName
      private Long nbAppels;
      @CsvBindByName
      private Double tempsDeReponseMoyenMillisecondes;
      @CsvBindByName
      private Long volume;
      @CsvBindByName
      private Double tempsDeReponseMoyenSecondes;
  }
  
  </code></pre>
  <p>controller :</p>
  <pre><code>  @PostMapping(&quot;/upload-csv-file&quot;)
      public String uplaodCSVFile(@RequestParam(&quot;file&quot;) MultipartFile file, Model model){
          if (file.isEmpty()){
              model.addAttribute(&quot;message&quot;, &quot;Veuillez selectionner un fichier csv à importer.&quot;);
              model.addAttribute(&quot;status&quot;, false);
          }else try (Reader reader = new BufferedReader(new InputStreamReader(file.getInputStream()))) {
  
              // create csv bean reader
              CsvToBean&lt;IndProdCsv&gt; csvToBean = new CsvToBeanBuilder(reader)
                      .withType(IndProdCsv.class)
                      .withSeparator(';')
                      .withIgnoreLeadingWhiteSpace(true)
                      .build();
  
              // convert `CsvToBean` object
              List&lt;IndProdCsv&gt; myIndProdCsv = csvToBean.parse();
              model.addAttribute(&quot;myIndProdCsv&quot;, myIndProdCsv);
              model.addAttribute(&quot;status&quot;, true);
  
          } catch (Exception ex) {
              model.addAttribute(&quot;message&quot;, &quot;An error occurred while processing the CSV file.&quot;);
              model.addAttribute(&quot;status&quot;, false);
              }
          return &quot;mon-dasboard&quot;;
      }
  </code></pre>
  <p>html with thymeleaf :</p>
  <p>tr th:each=&quot;ind, i : ${myIndProdCsv}&quot;</p>
  <p>td th:text=&quot;${ind.time}&quot;&gt;&lt;/td</p>
  <p>/tr</p>
  <p>and here is the error :</p>
  <pre><code>Caused by: org.apache.commons.beanutils.ConversionException: Can't convert value '2020-09-18T00:50:00+02:00' to type class java.time.OffsetDateTime
      at org.apache.commons.beanutils.converters.AbstractConverter.conversionException(AbstractConverter.java:474)
      at org.apache.commons.beanutils.converters.StringConverter.convertToType(StringConverter.java:96)
      at org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:169)
      at org.apache.commons.beanutils.converters.ConverterFacade.convert(ConverterFacade.java:61)
      at org.apache.commons.beanutils.ConvertUtilsBean.convert(ConvertUtilsBean.java:491)
      at com.opencsv.bean.ConverterPrimitiveTypes.convertToRead(ConverterPrimitiveTypes.java:118)
      ... 9 more
  </code></pre>
  <p>thank you for your help</p>