title: java.time.LocalDateTime conversion issue if seconds are 00
body: <p>My web application is using <strong>Apache CXF and JAVA8</strong>, and facing below error in response if user send <code>xs:datetime</code> input(seconds 00) as </p>
  
  <pre><code>&lt;urn1:dateTimeVal&gt;2016-04-29T20:00:00&lt;/urn1:dateTimeVal&gt;
  </code></pre>
  
  <p><strong>ERROR :</strong> </p>
  
  <blockquote>
    <p>org.apache.cxf.interceptor.Fault: Marshalling Error:
    cvc-datatype-valid.1.2.1: '2016-04-29T20:00' is not a valid value for 
    'dateTime'.</p>
  </blockquote>
  
  <p>I debug and analysed that if user send <code>dateTimeVal</code> as <code>2016-04-29T20:00:00</code> then CXF validations for input are passed and XML value is <strong>UnMarshaled</strong> to <code>java.time.LocalDateTime</code> as <code>2016-05-05T20:00</code> , and at the time of returning the response, the <strong>Marshaling</strong> error occurs due to loss of seconds part(00).</p>
  
  <p>Any help/hint are appreciated.</p>
  
  <p><strong>P.S</strong> : You can try with below snippet :</p>
  
  <pre><code>   java.time.LocalDateTime dt= java.time.LocalDateTime.of(2016, Month.MAY, 5, 20, 00, 00);
     System.out.println(dt);
  </code></pre>
  
  <p><strong>Note</strong> : Above code sample is just for understanding to print datetime value. But actual return type expected in web application is <code>java.time.LocalDateTime</code></p>
  
  <p><strong>OUTPUT EXPECTED</strong> : 2016-05-05T20:00:00</p>
  
  <p><strong>OUTPUT ACTUAL</strong>   : 2016-05-05T20:00</p>
  
  <p><strong>EDIT</strong> : The binding (JAXB) content for the field is :</p>
  
  <pre><code> @XmlElement(required = true, type = String.class)
      @XmlJavaTypeAdapter(LocalDateTimeAdapter.class)
      @XmlSchemaType(name = "dateTime")
      @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-05-03T05:28:57+05:30", comments = "JAXB RI v2.2.11")
      @NotNull
      protected LocalDateTime dateTimeVal;
  </code></pre>
  
  <p>AND <code>LocalDateTimeAdapter</code> File is </p>
  
  <pre><code> import java.time.LocalDateTime;
      import java.time.format.DateTimeFormatter;
      import java.time.format.DateTimeParseException;
      import java.time.temporal.TemporalAccessor;
      import javax.xml.bind.annotation.adapters.XmlAdapter;
  
      public class LocalDateTimeAdapter
        extends XmlAdapter&lt;String, LocalDateTime&gt;
      {
        public static LocalDateTime parse(String value)
        {
          DateTimeFormatter dateTimeAndZoneformatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
          DateTimeFormatter dateTimeformatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
          TemporalAccessor ta = null;
          try
          {
            ta = dateTimeformatter.parse(value);
          }
          catch (DateTimeParseException ex)
          {
            ta = dateTimeAndZoneformatter.parse(value);
          }
          return LocalDateTime.from(ta);
        }
  
        public static String print(LocalDateTime value)
        {
          return value.toString();
        }
  
        public LocalDateTime unmarshal(String value)
        {
          return parse(value);
        }
  
        public String marshal(LocalDateTime value)
        {
          return print(value);
        }
      }
  </code></pre>