When I get the hour of a time, it prints it in the 24 hour clock like this;
time1 = datetime.datetime.strptime("08/Jan/2012:08:00:00", "%d/%b/%Y:%H:%M:%S")
print 'hour is ', time1.hour
> time is 8
I'm trying to get it to show 08, instead of 8. For hours that are double digits its fine, but as soon as it gets to a single digit I'm trying to get that 0 in front of it.
I could potentially do 'time1.time' and then convert to string and then split it, and then convert the hour back into a datetime object, but this is pretty long winded and was wondering if there's a simpler solution?