Import time
Time.time () #为当前日期与UNIX纪元时间戳相差多少秒
Import datetime
Datetime.datetime.now () returns the DateTime object for the current time
Dt=datetime.datetime (2015,2,27,16,29,0) can pass in years, months, days, hours, minutes, seconds
Datetime.datetime.fromtimestamp (100000) incoming timestamp can be converted to datetime.datetime format
Datetime.datetime.fromtimestamp (Time.time ())
Delta=datetime.timedelta (days=11,hours=10,minutes=9,seconds=8) it represents a period of time
Delta.total_seconds () It is the number of seconds that this period represents
Print (S+DT) to add time and datetime.datetime format
Dateasstring=dt.striftime ('%y-%m-%d%h:%m:%s ') converts the Datetime.datetime format to a string
Stringasdate=dateasstring (dateasstring, '%y-%m-%d%h:%m:%s ') converts a string to datetime.datetime format, followed by a formatted string that needs to be consistent with the DateTime format
Python-time-datetime