用于管理会计日历的实用程序
fiscalyear的Python项目详细描述
概述
fiscalyear是一个小型、轻量级的python模块,为管理会计日历提供了有用的实用工具。它是内置datetime和calendar模块的扩展,添加了查询日期或日期时间对象的会计年度和会计季度的功能。
基本用法
fiscalyear提供了几个有用的类。
裂孔
FiscalYear类提供一个对象,用于存储有关特定会计年度开始和结束的信息。
>>>fromfiscalyearimport*>>>a=FiscalYear(2017)>>>a.startFiscalDateTime(2016,10,1,0,0)>>>a.endFiscalDateTime(2017,9,30,23,59,59)
财政季度
FiscalYear类还允许您查询有关特定季度的信息。
>>>a.q3.startFiscalDateTime(2017,4,1,0,0)>>>a.q3.endFiscalDateTime(2017,6,30,23,59,59)
这些对象表示独立的FiscalQuarter类。
>>>b=FiscalQuarter(2017,3)>>>b.startFiscalDateTime(2017,4,1,0,0)>>>b.endFiscalDateTime(2017,6,30,23,59,59)>>>a.q3==bTrue>>>binaTrue
财务日期时间
每个季度的开始和结束都存储为FiscalDateTime类的实例。这个类提供了与datetime类相同的所有特性,并增加了查询会计年度和季度的功能。
>>>c=FiscalDateTime.now()>>>cFiscalDateTime(2017,4,8,20,30,31,105323)>>>c.fiscal_year2017>>>c.quarter3>>>c.next_quarterFiscalQuarter(2017,4)
财务日期
如果您不关心FiscalDateTime类的时间组件,FiscalDate类适合您。
>>>d=FiscalDate.today()>>>dFiscalDate(2017,4,8)>>>d.fiscal_year2017>>>d.prev_fiscal_yearFiscalYear(2016)
安装
fiscalyear没有依赖项,因此安装起来既简单又容易。建议使用pip安装fiscalyear。
$ pip install fiscalyear
有关其他安装方法,请参见Installation Documentation。
文档
文档托管在Read the Docs。