1, Time module: times, DateTime;
1), Timestamp (SEC) 1970 00:00:00 defined as 0;time.time ()
2), formatted time string
3), tuple (struct_time) 9 elements: Year, month, day, time, minute,
seconds, weeks, the day of the year 0-6, tm_isdst=0;
access Method: Time.localtime ()
convert each other:
Timestamp ----> Tuple form:
time.gmtime (timestamp): Converted to international time tuple form
time.localtime (timestamp): Convert to local time tuple form
tuple form----> Timestamp:
time.mktime (tuple)
tuple Form----> formatted string:
time.strftime (' format ', struct_time)
Example: Time.strftime ('%y-%m-%d%h:%m:%s ', struct_time)
formatted string----> Tuple form:
time.strptime (' 2016-08-20 14:31:52 ', '%y-%m-%d%h:%m:%s ')
Other methods:
time.asctime ():
convert Struct_time to%a%b%d%h:%m:%s%Y string
time.ctime ():
convert timestamp (timestamp) to%a%b%d%h:%m:%s%Y string
Python Time and DateTime module