Get date with python

use datetime module

import datetime

datetime.date.today()#Today's date
datetime.datetime.today()#Until time

datetime.date.today().year#Year
datetime.date.today().day#Day

datetime.datetime.today().microsecond#It takes less than 1 second

datetime.date.today().isoformat()#Format specification
datetime.datetime.today().strftime("%Y/%m/%d/%H/%M/%S")#Format specification



Recommended Posts

Get date with python
[Python3] Get date diff
Get date in Python
Get country code with python
Get Youtube data with python
Get thread ID with python
Get started with Python! ~ ② Grammar ~
Get stock price with Python
Get home directory with python
Get keyboard events with python
Get Alembic information with Python
Get started with Python! ~ ① Environment construction ~
Link to get started with python
Get reviews with python googlemap api
Get the weather with Python requests
Get web screen capture with python
Get the weather with Python requests 2
[Python] Get economic data with DataReader
How to get started with Python
[Small story] Get timestamp with Python
Get Qiita trends with Python scraping
How to calculate date with python
Get started with Python in Blender
Get weather information with Python & scraping
FizzBuzz with Python3
Scraping with Python
Python date arithmetic
Statistics with python
Scraping with Python
Python with Go
Twilio with Python
Integrate with Python
Play with 2016-Python
AES256 with python
Tested with Python
python starts with ()
with syntax (Python)
Zundokokiyoshi with python
Excel with Python
Microcomputer with Python
Cast with python
Get property information by scraping with python
[Note] Get data from PostgreSQL with Python
Receive date type (datetime) with ArgumentParser [python]
Get Started with TopCoder in Python (2020 Edition)
[Python] Get Python package information with PyPI API
How Python beginners get started with Python with Progete
Let's get along with Python # 0 (Environment construction)
[Blender x Python] Let's get started with Blender Python !!
Serial communication with Python
Zip, unzip with python
Django 1.11 started with Python3.6
Primality test with Python
Python with eclipse + PyDev.
Socket communication with Python
Data analysis with python 2
Scraping with Python (preparation)
Python hand play (let's get started with AtCoder?)
[Python] Get environment variables
[Python] Get the files in a folder with Python
Learning Python with ChemTHEATER 03