Get the current time
Tuple conversion from floating point to return to the time stamp mode, as long as the transfer function localtime to float or the like.
Time Import
localtime = time.localtime (the time.time ())
Print ( "Local time is:", localtime)
Get formatted time
import time
localtime = time.asctime( time.localtime(time.time()) )
print (“本地时间为 :”, localtime)
Date Format
time.strftime(format[, t])
import time
Formatted form 2016-03-20 11:45:39
print (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
Formatted form Sat Mar 28 22:24:24 2016
print (time.strftime("%a %b %d %H:%M:%S %Y", time.localtime()))
Converting the timestamp format string
a = “Sat Mar 28 22:24:24 2016”
print (time.mktime(time.strptime(a,"%a %b %d %H:%M:%S %Y")))
Gets a calendar month
Calendar Import
CAL = of the Calendar.MONTH (2016, 1)
Print ( "the following output in January 2016 calendar:")
Print (CAL)