0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Python Tips

0
Posted at

自分用に、少しずつ業務用ロジックをPythonでまとめて行きます。

1. 年度を求める

import pytz
import datetime
from dateutil.relativedelta import relativedelta

jst = pytz.timezone('Asia/Tokyo')
now = datetime.datetime.now(jst)
fiscal_year = (now + relativedelta(months=-3)).strftime("%Y")

現在から3カ月前の年を求めることで、年度が分かる。ここの年度というのは4月から3月までです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?