get_financial_year

pyrcs.parser.get_financial_year(date)[source]

Gets the financial year of a given date.

The financial year runs from 1st April to 31st March of the following year. This function takes a date and determines the financial year it falls into.

Parameters:

date (datetime.datetime) – The date for which the financial year is to be determined.

Returns:

The financial year of the given date.

Return type:

int

Examples:

>>> from pyrcs.parser import get_financial_year
>>> import datetime
>>> financial_year = get_financial_year(date=datetime.datetime(2021, 3, 31))
>>> financial_year
2020