Below is a program to determine when my next appointment is. Line numbers are provided for reference only.

01  import time, datetime, sys
02  from datetime import date
03  today = date.today()
04  print
05  print "Today date is:", today
06  todaystr = str(today)
07  print
08  print "Corrected date format is:",
09  print todaystr[ 5: 7], todaystr[ 8:10], todaystr[ 0: 4]
10  print
11  future = raw_input("Next appointment is in how many days?  "),
12  print
13  difference1 = datetime.timedelta(days=1)
14  datestring = str(today + difference1)
15  print "Next appointment after that is:",datestring
16  print
17  print "Corrected date format for next appointment is:",
18  print datestring[ 5: 7], datestring[ 8:10], datestring[ 0: 4]
19  sys.exit()

In answering the question in line 11 as to when is my next appointment, I would answer "3" (for 2/3/2010) but how do I change "days=1" at end of line 13 to "days=3" so that datestring would read "2010-02-03" instead of "2010-02-01" as presented above?

TIA,

Ken
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to