I seems to me that you add a datetime.timedelta of one hour to a datetime.datetime to get a new datetime.datetime.
Gribouillis
Posting Maven
2,786 posts since Jul 2008
Reputation Points: 1,044
Solved Threads: 691
Grib means this:
import datetime
mydate=['20111025.00', '20111026.12']
fmt = "%Y%m%d.%H"
hour = datetime.timedelta(hours=1)
start_time, end_time = [datetime.datetime.strptime(d, fmt) for d in mydate]
now = start_time
while now <= end_time:
print now.strftime(fmt)
now += hour
Doing this manually by normal loop is also not so tough job.
pyTony
pyMod
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
pyTony
pyMod
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852