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