Help us understand the problem. What is going on with this article?

[Python3]日付の差分を取得する

More than 3 years have passed since last update.

日数計算という便利なサイトがあります。
http://keisan.casio.jp/exec/system/1177658154

これっぽいのを再現します。

calc_days.py
import datetime
a = datetime.date(2015, 4, 1)
b = datetime.date(2016, 1, 25)
print((b-a).days)
# 299

ちなみにこの値は、初日を含んでいないので、〜日目の表記をしたい場合は+1しましょう。

wonder_zone
殴り書きみたいなメモ帳。
http://can.hatenadiary.com/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away