title: How to parse a date in a header using Camel?
body: <p>In Camel route that converts WARC entries into a custom file format for each entry, I need to parse some dates that can be found the original HTTP headers.</p>
  
  <p>I have in an input header the Date (and the Last-Modified date) as provided by an HTTP server (normally relying on the format described in RFC2616, i.e. something like <code>Wed, 09 Apr 2014 11:59:14 GMT</code>).</p>
  
  <p>I need to parse this date in the input header and to store it as a <code>Date</code> in the output header.</p>
  
  <p>I tried:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;setHeader headerName="weblab:dct:modified"&gt;
     &lt;simple resultType="java.util.Date"&gt;${headers.ArchiveRecordPayloadHeader['Last-Modified']}&lt;/simple&gt;
  &lt;/setHeader&gt;
  </code></pre>
  
  <p>This crashes saying that the date <code>Wed, 09 Apr 2014 11:59:14 GMT</code> is not in the right format.</p>
  
  <p>I also tried:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;setHeader headerName="weblab:wlp:hasGatheringDate"&gt;
      &lt;simple resultType="java.util.Date"&gt;${date:in.header.ArchiveRecordPayloadHeader['Date']:EEE, dd MMM yyyy HH:mm:ss zzz}&lt;/simple&gt;
  &lt;/setHeader&gt;
  </code></pre>
  
  <p>But is crashes saying that it cannot find a Date in <code>in.header.ArchiveRecordPayloadHeader['Date']</code>. It seems that this is meant to format date not for parsing.</p>
  
  <p>Any idea?
  Thank you in advance</p>