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