How to use 'python current year' in Python

Every line of 'python current year' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
3def get_current_school_year():
4 "Utility method: returns the current *academic* year."
5 today = datetime.date.today()
6 year = today.year
7 # School year starts in late August, more or less
8 if today.month < 8 or today.month == 8 and today.day < 20:
9 year -= 1
10 return year

Related snippets