0
2

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 2019-01-25

Pythonでは現在の日時を取得可能

場合によってはミリ秒以下でも取得できるらしい

必要なモジュール

datetime

import

import datetime

今日の日付

datetime.date.today() 
datetime.datetime.today() # +時間

datetime.date.today().year

###日

datetime.date.today().day#日

まとめて


import datetime

datetime.date.today()#今日の日付
datetime.datetime.today()#今日の日付+時間
datetime.date.today().year#年
datetime.date.today().day#日

0
2
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
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?