Import TimePrint(Time.time ())#1970 to present time, in the form of seconds#Time.sleep (1) # delay, CPU not workingPrint(Time.clock ())#Calculate CPU Execution TimePrint(Time.gmtime ())#structured time, UK world standard TimePrint(Time.localtime ())#local time#Print (Help (time.strftime))Struct_time =time.localtime ()Print(Time.strftime ('%y-%m-%d%h:%m:%s', Struct_time))#format Time#part of the time taken outPrint(Time.strptime ('2017-11-11 19:44:08','%y-%m-%d%h:%m:%s'))#turn into structured timea= Time.strptime ('2017-11-11 19:44:08','%y-%m-%d%h:%m:%s')Print(a.tm_year)#which yearPrint(A.tm_mday)#the first day of one monthsPrint(A.tm_wday)#Day of the week one#time stamp, structured time, format time;Print(Time.ctime ())#define the current time of the formatPrint(Time.ctime (3600))#parameter represents 1970 to present timePrint(Time.mktime (Time.localtime ()))#format time into timestamp#----------------------->> datetimeImportdatetimePrint(Datetime.datetime.now ())#2017-11-11 19:57:53.182881
Time Module | DateTime Module | Python