2017/03/17

Python - How to get current date time and format its output

This is a quick summary of how to get the current date and time and format its output in Python.

The Code

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

The Result


Reference:

No comments:

Post a Comment