Skip to content

Instantly share code, notes, and snippets.

@idealwebsolutions
Created March 9, 2017 08:36
Show Gist options
  • Save idealwebsolutions/b99ce47cf9bfafe2bc78b5d383696173 to your computer and use it in GitHub Desktop.
Save idealwebsolutions/b99ce47cf9bfafe2bc78b5d383696173 to your computer and use it in GitHub Desktop.
Get century from year
function centuryFromYear(year) {
return year % 100 === 0 ? Math.trunc(year / 100) : Math.trunc(year / 100) + 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment