DEV Community

Aman Pareek
Aman Pareek

Posted on

5 1

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)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more