how to just get year from a date react code example Example: how to get year in react getYear() { return new Date().getFullYear(); }