how to get only year from date in html code example Example: how to get the year in javascript new Date().getFullYear(); // This will get you the current year