那不是密码!请张贴简短,完整的示例代码来说明一个问题。下面是我认为您正在尝试做的事情,但是如果没有看到您的代码,任何人都无法指出您的错误。
from datetime import datetime
# build up some datetime objects.
z = datetime.strptime('2010-11-14 14:55:04.293000','%Y-%m-%d %H:%M:%S.%f')
b = datetime.strptime('2010-11-14 14:53:34.824000','%Y-%m-%d %H:%M:%S.%f')
a = datetime.strptime('2010-11-14 14:50:14.155000','%Y-%m-%d %H:%M:%S.%f')
# display them
print 'z =',z
print 'b =',b
print 'a =',a
# print the minute
print 'z min =',z.utctimetuple().tm_min
print 'b min =',b.utctimetuple().tm_min
print 'a min =',a.utctimetuple().tm_min
# print the minute an easier way
print 'z min =',z.minute
print 'b min =',b.minute
print 'a min =',a.minute
输出:
z = 2010-11-14 14:55:04.293000
b = 2010-11-14 14:53:34.824000
a = 2010-11-14 14:50:14.155000
z min = 55
b min = 53
a min = 50
z min = 55
b min = 53
a min = 50