Answers for "how to get date using python"

2

get date and time in python

from datetime import datetime

now = datetime.now().time().strftime("%H:%M:%S") # time object
date = datetime.now().strftime("%Y-%m-%d") # date object
print("date:",date)
print("time =", now)
Posted by: Guest on March-13-2021

Code answers related to "how to get date using python"

Python Answers by Framework

Browse Popular Code Answers by Language