title: DateTime parser format in java 8
body: <p>I am trying to parse a datetimeStamp as below but I am not able to find the correct parser for it. Can someone advise how can I parse such dates:</p>
  <pre><code>import java.time.format.DateTimeFormatter;
  import java.time.LocalDateTime;
  public class HelloWorld{
  
       public static void main(String []args){
            int DAYS = 30;
           String date =&quot;2021-04-23T12:09:56.123-07:00&quot;;
              DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter
        .ofPattern(&quot;YYYY-MM-DD'T'hh:mm:ss.SSS±hh:mm&quot;);
          
          LocalDateTime localDateTime = LocalDateTime.parse(date, DATE_TIME_FORMATTER);
          System.out.println(&quot;Local Date&quot; + localDateTime);
        LocalDateTime now = LocalDateTime.now();
        if (localDateTime.isBefore(now) &amp;&amp; localDateTime.isAfter(now.plusDays(DAYS)))
          {
               System.out.println(&quot;Date is incorrect&quot;);
          }else{
               System.out.println(&quot;Success&quot;);
          }
       }
  }
  </code></pre>
  <p>Below is also a bit of additional detail:
  Must be expressed in ISO 8601 extended format as one of the following - YYYY-MM-DDThh:mm:ss[ .sss ]Z, YYYY-MM-DDThh:mm:ss[ .sss ]±hh:mm . Where [ .sss ] is optional and can be 1 to 3 digits. Must be a value no more than 30 days in the future. Mastercard recommends using a value of (Current Time + 30 minutes). Max length - 29. Type - String.
  example: &quot;2015-07-04T12:09:56.123-07:00&quot;</p>
  <p>Please help me with the correct formatter for the day specified.</p>