datetime.now().strftime("%m/%d/%Y") code example
Example 1: python datetime milliseconds
from datetime import datetime
print(datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3])
Example 2: create.strftime('%Y-%m-%d %h:%m:%s')
from datetime import datetime
now = datetime.now()
year = now.strftime("%Y")
print("year:", year)
month = now.strftime("%m")
print("month:", month)
day = now.strftime("%d")
print("day:", day)
time = now.strftime("%H:%M:%S")
print("time:", time)
date_time = now.strftime("%m/%d/%Y, %H:%M:%S")
print("date and time:",date_time)