var theDate = new Date();

function writeThisYear() { // write the current Year
document.write(theDate.getFullYear());
}