title: Get Date from timestamp in Groovy
body: <p>As trivial as it may seem, I cannot find a way to transform a Unix timestamp into a Date object in Groovy.</p>
  
  <p>Let me try with <code>1280512800</code>, which should become <code>Fri, 30 Jul 2010 18:00:00 GMT</code></p>
  
  <p>My first attempt was</p>
  
  <pre><code>new Date(1280512800)
  // wrong, becomes Thu Jan 15 20:41:52 CET 1970
  </code></pre>
  
  <p>Then I read that Java timestamps use milliseconds, hence I should use</p>
  
  <pre><code>new Date((long)1280512800 * 1000)
  // the cast to long is irrelevant in Groovy, in any case I get
  // Thu Jan 08 03:09:05 CET 1970
  </code></pre>
  
  <p>What is the right way to convert a timestamp to a Date? What if I want to specify the timezone to work in?</p>