Home >Backend Development >Python Tutorial >Summary of processing time using python
Date and time processing module:
time
calendar
Current timestamp: time.time() Decimal number in seconds
Date Range: 1970-01-01 to 2038
Time tuple:
Get the current timestamp: time.time()
Get the time tuple of the current time: time.localtime(timestamp)
Get the formatted date: time.strftime("%Y-%m-%d %H:%M:%S", time tuple)
str = "2016-10-10 10:10:10"
Convert string to time tuple: time.strptime(str,"%Y-%m-%d %H:%M:% S")
Convert time tuple to timestamp: time.mktime(time tuple)
The above is the detailed content of Summary of processing time using python. For more information, please follow other related articles on the PHP Chinese website!