Summary of processing time using python

高洛峰
Release: 2017-03-26 17:58:58
Original
981 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!