41
36

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で日付取得

Last updated at Posted at 2016-08-24

datetimeモジュールを使う

import datetime

datetime.date.today()#今日の日付
datetime.datetime.today()#時間まで

datetime.date.today().year#年
datetime.date.today().day#日

datetime.datetime.today().microsecond#1秒以下も出る

datetime.date.today().isoformat()#フォーマットの指定
datetime.datetime.today().strftime("%Y/%m/%d/%H/%M/%S")#フォーマットの指定

41
36
1

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
41
36

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?