title: Javascript: how to calculate the beginning of a day with milliseconds?
body: <p>i want to figure out the time from the beginning of the day given a days milliseconds.</p>
  
  <p>so say i'm given this: 1340323100024 which is like mid day of 6/21/2012. now i want the milliseconds from the beginning of the day, which would be 1340262000000 (at least i think that's what it's supposed to be.)</p>
  
  <p>how do i get 1340262000000 from 1340323100024?</p>
  
  <p>i tried doing</p>
  
  <pre><code>Math.floor(1340323100024/86400000) * 86400000 
  </code></pre>
  
  <p>but that gives me 1340236800000, which if i create a date object out of it, says its the 20th.</p>
  
  <p>i know i can create a date object from 1340323100024, then get the month, year, and date, to create a new object which would give me 1340262000000, but i find it ridiculous i can't figure out something so simple.</p>
  
  <p>any help would be appreciated.</p>
  
  <p>btw, i'm doing this in javascript if it makes any difference.</p>