Skip to content

How to get current date in Python?

from datetime import datetime
now =
print (now.strftime("%Y-%m-%d %H:%M:%S"))

Output: 2020-06-19 10:34:45
See also  Python code snippet - How to write if statement in one line ?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.