3
3

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.

datetimeモジュール使い方

Last updated at Posted at 2015-07-14

毎回うっすら忘れてシンタックスエラーなのでメモ

参照

UTCで現在時刻を取得

now = datetime.datetime.utcnow()

指定の日時を指定

the_day = datetime.datetime(2015, 6, 2, 21, 0, 0, 0)

計算

start = now - datetime.timedelta(days=96)
使えるパラメーターは([days,seconds,microseconds,milliseconds,minutes,hours, weeks])

3
3
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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?