Home  >  Article  >  Backend Development  >  Summary of processing time using python

Summary of processing time using python

高洛峰
高洛峰Original
2017-03-26 17:58:581040browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn