[Tutor] Date subtraction

Deirdre Saoirse deirdre@deirdre.net
Fri, 6 Apr 2001 11:17:50 -0700 (PDT)


On Fri, 6 Apr 2001, Turhan Arun wrote:

> I want to have a user enter a date in format dd/mm/YYYY like 06/04/2001
> and another date in the same format like 22/04/2001
> depending on these two inputs. I just want to create a list of date
> strings like
> ['06/04/2001','07/04/2001','08/04/2001'....]
> It will be great if you could give some idea.

Convert them from those dates into numeric representations of dates using
the time module:

import time


datea = '06/04/2001'
dateb = '07/04/2001'

tuplea= time.strptime(datea, '%m/%d/%Y')
tupleb= time.strptime(dateb, '%m/%d/%Y')

(etc)

--
_Deirdre   NEW Stash-o-Matic: http://fuzzyorange.com  http://deirdre.net
"I love deadlines. I like the whooshing sound they make as they fly by."
                                                         - Douglas Adams