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