title: Round a timestamp to the nearest date
body: <p>I need to group a bunch of items in my web app by date created.</p>
  
  <p>Each item has an exact timestamp, e.g. <code>1417628530199</code>. I'm using <a href="http://momentjs.com/" rel="noreferrer">Moment.js</a> and its "<a href="http://momentjs.com/docs/#/displaying/fromnow/" rel="noreferrer">time from now</a>" feature to convert these raw timestamps into nice readable dates, e.g. <code>2 Days Ago</code>. I then want to use the readable date as a header for a group of items created on the same date.</p>
  
  <p>The problem is that the raw timestamps are too specific - two items that are created on the same date but a minute apart will each have a unique timestamp. So I get a header for <code>2 Days Ago</code> with the first item underneath, then another header for <code>2 Days Ago</code> with the second item underneath, etc.</p>
  
  <p>What's the best way to round the raw timestamps to the nearest date, so that any items created on the same date will have the exact same timestamp and thus can be grouped together?</p>