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
this disclaimer
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
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code


Related snippets