time(time library,datetime library,panda.Timestamp())
import time
获得当前时间
1 | time.time() #获得当前timestamp |
time.localtime(timestamp)
得到一个struct_time
time.struct_time(tm_year=2018…)
将struct time转换成string
Convert a tuple or struct_time representing a time as returned by gmtime() or localtime() to a string as specified by the format argument.If t is not provided,the current time as returned by localtime() is used.
1 | import time |
将一个string类型的事件转换成struct time
Parse a string representing a time accroding to a format.The return value is a struct_time as returned by gmtime() or localtime()
1 | import time |
time.mktime()
将时间t转换成timestamp