javascript new Date year code example Example: JS date year var d = new Date(); var n = d.getFullYear();