Answers for "datetime.datetime how to import"

2

import datetime

from datetime import datetime

date = datetime.now()
print(date)
# Prints in the format year, month, day, hour, minute, second, and microsecond
Posted by: Guest on February-15-2021
5

python datetime module

import datetime as d
time = d.datetime.now()
time = time.strftime("%Y-%m-%d  %H:%M:%S")
           #year-#month-#date  #hour:#minure:#second
print(time)
Posted by: Guest on May-06-2021

Python Answers by Framework

Browse Popular Code Answers by Language