Navigate back to the homepage

How to get current year in typescript?

February 7th, 2022 · 1 min read
keep affilitate

Hello Friends 👋,

Welcome To Infinitbility! ❤️

To get the current year in typescript has the new Date().getFullYear() method which will return every time the current year in number datatype.

we have to just call new Date().getFullYear() and it will check the current date and return the current year based on the date.

1let year: number = new Date().getFullYear();
2console.log(year); // 2022

Now, we know how to get the current year in typescript and the way to hold in a variable.

TypeScript has a new Date() object which is similar to javascript and the date object provides the getFullYear() method which will return the year store in the new date object.

Thanks for reading…

Follow me on Twitter

Join our email list and get notified about new content

No worries, I respect your privacy and I will never abuse your email.

Every week, on Tuesday, you will receive a list of free tutorials I made during the week (I write one every day) and news on other training products I create.

melio affilitate

Looking For React Native Tutorial?

we are trying to create the best Tutorial for react native developers.

When you want a daily updates about React Native Tutorial or infinitbility update subscribe to our newsletter.

Read React Native Tutorial

Request New Tutorial or Article on mail [email protected]

Guide book

Guidebook: The Javascript Monorepo Photoshop Guide



More articles from Infinitbility

How to get current time in typescript?

TypeScript, get current time example.

February 6th, 2022 · 1 min read

How to get current date in typescript?

TypeScript, get current date example.

February 5th, 2022 · 1 min read
© 2020–2022 Infinitbility
Link to $ to $ to $ to $ to $ to $mailto:[email protected]