function getDateAgo(date, days) { var dateCopy = new Date(date); dateCopy.setDate( date.getDate() - days ); return dateCopy.getDate(); }