title: Groovy - Compare date and Time
body: <p>I have two strings , which are each got from respective shell commands and are not uniformly formatted. 
  Two strings obtained are as follows: </p>
  
  <pre><code>Date : Tue Feb 28 16:23:20 2017 -0600
  Executed at : Tue Feb 28 17:24:06 EST 2017 
  </code></pre>
  
  <p>EDIT: I get the above mentioned dates , one through git log and other through cat and store both in variables</p>
  
  <p>First date is got through and stored in X: </p>
  
  <pre><code>  sh 'git log &lt;file&gt; | grep Date | head -n 1 &gt; X '
  </code></pre>
  
  <p>Second date is got through below and stored in Y:</p>
  
  <pre><code>   sh 'cat chef-policy-release.log | grep &lt;file&gt; | tail -n 1 | grep -o "Executed at.*" &gt; Y' 
  </code></pre>
  
  <p>Now I wanted to pick out just date and time among that and wanted to check if executed time is after the Date value or not ? </p>