Answers for "getting date from datetime in 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 "getting date from datetime in python"

Python Answers by Framework

Browse Popular Code Answers by Language