Javascript Get Last Two Digits of Year
In this tutorial, we will learn how to get the last two digits of the year. We use the new Date() object to retrieve the current year using the getFullYear() method. Then, we apply the % 100 operator to obtain the last two digits of the year. Feel free to modify the code if you want to make changes using tryit.
written
reviewed
updated
Thanks for your feedback!
Your contributions will help us to improve service.
Output of Javascript Get Year 2 Digit
Ad