我有一个小时,一分钟,一秒钟的时间
serverTime = 'Jul 2, 2018 3:21:56 PM'
serverTime = serverTime.strftime('%H:%M:%S')
serverTime = datetime.strptime(serverTime, '%H:%M:%S').time()
print(serverTime)
>> 15:21:56
print(type(serverTime))
>> <class 'datetime.time'>
我有一个像这样的时间
openTimeFrom = timedelta(milliseconds=hours['fromT']
print(serverTime)
>> 08:00:00
print(type(openTimeFrom))
>> <class 'datetime.timedelta'>
我想比较openTimeFrom
和serverTime
来确定serverTime
是否大于openTimeFrom
,但是我什么时候做
if serverTime > openTimeFrom:
我遇到此错误
TypeError:“ datetime.time”和“ datetime.timedelta”实例之间不支持“>”