Reputation: 13515
In this code mDATE0
for 3 items a
, b
, z
is:
mUNIQUE: z | mDATE0: 2010-11-14 14:55:04.293000
mUNIQUE: b | mDATE0: 2010-11-14 14:53:34.824000
mUNIQUE: a | mDATE0: 2010-11-14 14:50:14.155000
But when I do
...
utc_tuple = rep.mDATE0.utctimetuple()
...
corresponding utc_tuples
are:
utc_tuple: time.struct_time(tm_hour=14, tm_min=55)
utc_tuple: time.struct_time(tm_hour=14, tm_min=55)
utc_tuple: time.struct_time(tm_hour=14, tm_min=55)
In other words min=55
for all items while mDATE0
has
z --> min=55;
b --> min=53;
a --> min=50
What am I doing wrong? Please see my related question. Thanks.
Upvotes: 1
Views: 3086
Reputation: 177674
That isn't code! Please post short, complete example code to illustrate a problem. Below is what I think you are trying to do, but without seeing your code, there is no way for anyone to point your bug.
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
Upvotes: 3