Java - Convert Unix epoch time to date
<p>I need to convert some epoch time stamps to the real date and have used some of the methods I found on stack overflow, but they give the wrong answer.</p>

<p>As an example, one date is "129732384262470907" in epoch time, which is "Mon, 20 Jan 6081 05:24:22 GMT" using <a href="http://www.epochconverter.com/" rel="nofollow">http://www.epochconverter.com/</a></p>

<p>However, my code generates: "Wed Dec 24 14:54:05 CST 19179225"</p>

<pre><code>  String epochString = token.substring(0, comma);
  long epoch = Long.parseLong(epochString);
  Date logdate = new Date(epoch * 1000);
  BufferedWriter timewrite = new BufferedWriter(new FileWriter(tempfile, true));
  timewrite.write(logdate);
  timewrite.flush();
  timewrite.close();
</code></pre>

<p>The initial timestamp is in miliseconds, which in the examples I saw here I am supposed to multiply by 1000.</p>

<p>If I don't multiply by 1000, I get: "Mon Aug 08 01:14:30 CDT 4113025"</p>

<p>Both of which are wrong.</p>

<p>So where have I made my error?</p>
