Get current Fiscal date range in python?

44 Views Asked by At

How can i get the current fiscal date range? Expected output : start_date = '2022-04-01' last_date = '2023-03-31'

Please help. Many thanks in advance.

1

There are 1 best solutions below

0
Victor Vincent On

Did you tried the Fiscalyear Libary? https://pypi.org/project/fiscalyear/ There you can get Info about the Fiscal year, quarter, month and day

>>> e = FiscalDateTime.now()
>>> e
FiscalDateTime(2017, 4, 8, 20, 30, 31, 105323)
>>> e.fiscal_year
2017
>>> e.fiscal_quarter
3
>>> e.next_fiscal_quarter
FiscalQuarter(2017, 4)
>>> e.fiscal_month
7
>>> e.fiscal_day
190