datetime - How to get current time in Python
ringa_lee
ringa_lee 2017-06-28 09:25:57
0
1
1241

How to get the current time in Python, the format is as follows:

2017-06-23 22:12:35
ringa_lee
ringa_lee

ringa_lee

reply all(1)
阿神

Reference article: Get the current time in Python

time module (low level)

import time
time.strftime("%Y-%m-%d %H:%M:%S")

datetime module (high level Object-oriented interface to dates and times)

import datetime
datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") 
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!