Saturday, June 12, 2010

Calculating time difference for reservations using Python


import datetime
# Since I wish to do reservation on 12 Sept 2010
d = datetime.datetime(2010,09,12)
# I can do reservation 90 days before
b = datetime.timedelta(90)
# The day when I can do reservation is
print d - b

0 comments: