You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何计算最近5个财政年度的最后截止日期?需结合当前日期与3月31日判断

最近5个财政年度最后截止日期计算规则

财年默认以每年3月31日为截止节点,最近5个财年截止日的判断规则如下:

  • 若当前日期晚于当年3月31日,输出结果为:2021年3月31日、2020年3月31日、2019年3月31日、2018年3月31日、2017年3月31日
  • 若当前日期早于当年3月31日,输出结果为:2020年3月31日、2019年3月31日、2018年3月31日、2017年3月31日、2016年3月31日

上述固定年份为当前日期在2021-2022年区间的示例输出,如需适配任意时间的通用计算,核心逻辑为:先判断当前日期是否超过当年3月31日,超过则基准年取当前年,未超过则基准年取当前年减1,再从基准年开始往前倒推5年,每年取3月31日即可。

参考Python实现代码如下:

import datetime

def get_recent_5_fy_end_dates():
    today = datetime.date.today()
    curr_year = today.year
    year_cutoff = datetime.date(curr_year, 3, 31)
    base_year = curr_year if today > year_cutoff else curr_year - 1
    return [datetime.date(base_year - i, 3, 31) for i in range(5)]

内容的提问来源于stack exchange,提问作者Akshay Gaikwad

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.29 04:54:03