extract year from a date in javascript code example Example: get year from date javascript document.write(new Date().getFullYear());