title: Apache Nifi Expression Language - toDate formatting
body: <p>I am trying to format a date string using the Apache Nifi expression language and the Replace Text processor(regex). Given a date string</p>
  
  <pre><code>date_str : "2018-12-05T11:44:39.717+01:00", 
  </code></pre>
  
  <p>I wish to convert this to:</p>
  
  <pre><code>correct_mod_date_str: "2018-12-05 10:44:39.717", 
  </code></pre>
  
  <p>(notice how the date is converted to UTC, and character 'T' replaced by a space.) </p>
  
  <p>To do this, I am currently using:</p>
  
  <pre><code>toDate("yyyy-MM-dd'T'HH:mm:ss.SSSSSSXXX"):format("yyyy-MM-dd HH:mm:ss.SSS", '+00:00')
  </code></pre>
  
  <p>and this works perfectly.</p>
  
  <p>However, when the date string has 6 digits in <em>ms</em>, rather than 3, things break:</p>
  
  <pre><code>another_date_str: "2018-12-05T11:44:39.717456+01:00"
  </code></pre>
  
  <p>is converted to:</p>
  
  <pre><code>incorrect_mod_date_str: "2018-12-05 10:56:36.456"
  </code></pre>
  
  <p>It seems the first 3 digits in the <em>ms</em> precision interferes with the conversion.</p>
  
  <p>Appreciate inputs to resolve this -  what am I missing?</p>
  
  <p>Regards</p>