2 ( we have split the digit 2 from number 12) Now, we have to split the digit 1 from number 12. This Java program is the same as the above last digit example. But this time, we are creating a separate Java method to find the First Digit of the user-entered value. Yes, n will give you the 4 digit year, but you can always use substring or something similar to split up the year, thus giving you only two digits: var final = n.toString().substring(2); This will give you the last two digits of the year (2013 will become 13, etc...) If there's a better way, hopefully someone posts it! There is a JS function .charAt() you can use that to find the last digit, How to remove selected values from dropdown once its submitted, document.getElementById(' ').value returns undefined, How to change video js source with a link click, Getting values from a