Import time
Get current time:
Specify string format: Time.strftime ("%y-%m-%d%h:%m:%s")
current timestamp:time.t IME ()
Current time tuple format: Time.localtime ()
String to TIME format
Converts a time string to a tuple in the specified format <class ' time.struct_time ' >
Time.strptime ("string", Format ("%y-%m-%dt%h:%m:%sz"))
Convert the time format to a timestamp:
Time.mktime (tuple in ' class ' Time.struct_time ' format) #将时间格式元组转换为时间戳 <class ' float ' >
Time.gmtime (timestamp) converts a timestamp to a UTC time tuple
Time.localtime (timestamp) converts a timestamp to a time-tuple in the local time zone
Time.ctime (' timestamp ') converts a timestamp to a string (local time) such as Sat May 26 21:11:24 2018
Time.asctime (time tuple) converts a time format tuple to a specific fixed format string such as Sat May 26 21:11:24 2018
Python3 May 26 Time module Common times conversion