title: Java Date problems, finding the date X days ago
body: <pre><code>Date nowdate = new Date();
  long nowms = nowdate.getTime();
  long differencems = numdaysback * 24 * 60 * 60 * 1000;
  long thenms = nowms - differencems;
  Date thendate = new Date(thenms);
  </code></pre>
  
  <p>If numdaysback is 365, then I would suppose that thendate would be one year ago. but it's not... it's about three weeks ago?!?</p>
  
  <pre><code>NUMDAYSBACK: 365
  NOWDATE: Wed Jun 22 20:31:58 SGT 2011
  NOWMS: 1308745918625
  DIFFERENCEMS: 1471228928
  THENMS: 1307274689697
  THENDATE: Sun Jun 05 19:51:29 SGT 2011
  </code></pre>