Import Time # mainly for time Check
# output current timestamp
Print (the time.time ())
# acquires the current date
Print (The time.strftime ( ' %% Y-M-% D ' ))
# stamp transfer date
Print (The time.strftime ( " % D%% Y-M-% H:% M:% S " , time.localtime ()))
print('=====================')
Import datetime # most of the time for calculating
Print (datetime.datetime.now ())
# Calculation time of ten minutes after the
# constructor: the datetime.timedelta (Days = 0, = 0 seconds The, = 0 microseconds, milliseconds = 0, = 0 minutes, hours = 0, = 0 weeks)
# where parameters are optional The default value is 0
NEWTIME the datetime.timedelta = (= 10 minutes )
Print (datetime.datetime.now () + NEWTIME) # current time plus 10 minutes
# Calculated after 10 days time
one_day = A datetime.datetime (2019,10,13 )
new_date = datetime.timedelta(days=10)
print(one_day+new_date) # 2019-10-23 00:00:00
# 2019-10-1411: 26: 07.313722 ".313722" refers 0.313722 seconds seconds inside the computer is not the smallest unit
Python3-- time & date library
Guess you like
Origin www.cnblogs.com/gjh99/p/12103551.html
Ranking