how to get the date of month ago in javascript code example Example: js months ago var d = new Date(); d.setMonth(d.getMonth() - 3);