DEV Community

Aman Pareek
Aman Pareek

Posted on

How to get current year in Next JS

Below code will help you to get full year in next JS.

function year() {
    const date = new Date();
    const year = date.getFullYear();
    return (
        <>
            <div>Current year is {year}</div>
        </>
  )
}

export default year;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)