title: I want to convert a date from String to LocalDateTime using DateTimeFormatterBuilder ()
body: <p>does not convert the last digit of the date under the 16 index to</p>
  <pre><code>private LocalDateTime parseDate(String date) {
  dateOut = LocalDateTime.parse(date, fmt);
  </code></pre>
  <p>an error appears:</p>
  <blockquote>
  <p>java.time.format.DateTimeParseException: Text '27 апр 21, 01:42' could
  not be parsed at index 16</p>
  </blockquote>
  <p>I can't find the answer.
  Thank you for your answers.</p>
  <pre><code>public class HtmlParse {
  
      private LocalDateTime lastDate = null;
      private LocalDateTime dateTime = null;
      private DateTimeFormatter fmt = new DateTimeFormatterBuilder()
              .appendPattern(&quot;d &quot;)
              .appendText(ChronoField.MONTH_OF_YEAR, new HashMap&lt;&gt;() { {
                  put(1L, &quot;янв&quot;); put(2L,  &quot;фев&quot;); put(3L,  &quot;мар&quot;); put(4L,  &quot;апр&quot;);
                  put(5L, &quot;май&quot;); put(6L,  &quot;июн&quot;); put(7L,  &quot;июл&quot;); put(8L,  &quot;авг&quot;);
                  put(9L, &quot;сен&quot;); put(10L, &quot;окт&quot;); put(11L, &quot;ноя&quot;); put(12L, &quot;дек&quot;);
              } })
              .appendPattern(&quot; yy, HH:mm&quot;)
              .toFormatter(new Locale(&quot;ru&quot;));
  
      public void setLastDate(LocalDateTime lastDate) {
          this.lastDate = lastDate;
      }
  
      private LocalDateTime parseDate(String date) {
          LocalDateTime dateOut;
              dateOut = LocalDateTime.parse(date, fmt);
          return dateOut;
      }
  
  
      public Post detail(String postLink) {
          Post post = null;
          try {
              Document doc = Jsoup.connect(postLink).get();
              String name = doc.title().split(&quot; / Вакансии&quot;)[0];
              String text = doc.select(&quot;td.msgBody&quot;).get(1).text();
              String date = doc.select(&quot;td.msgFooter&quot;).get(0).text();
              this.dateTime = this.parseDate(date.substring(0, date.indexOf(&quot;[&quot;)));
              post = new Post(name, text, dateTime, postLink);
          } catch (IOException e) {
              LOG.error(e.getMessage(), e);
          }
          return post;
      }
  
  
  
      public static void main(String[] args) throws SchedulerException {
          String link = &quot;https://www.sql.ru/forum/job-offers/&quot;;
          HtmlParse htmlParse = new HtmlParse();
          htmlParse.setLastDate(LocalDateTime.of(2020, 1, 1, 0, 0));
          List&lt;Post&gt; list = htmlParse.parser(link);
          for (Post p : list) {
              System.out.println(p);
          }
      }
  }
  </code></pre>