4 examples of 'how to get current year in python' in Python

Every line of 'how to get current year in python' 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
22def get_financial_year(year):
23 return get_financial_year_start(year), get_financial_year_start(year + 1) - timedelta(microseconds=1)
3def get_year(roll):
4 roll = str(roll)
5 if(roll[0]=='i'):#iitu
6 year = roll[5:7]
7 else:
8 year = roll[0:2]
9 return year
9def get_current_month_date():
10 today = date.today()
11 datem = date(today.year, today.month, 1)
12 return datem

Related snippets