On 22 sep, 11:37, Konstantinos Pachopoulos <[EMAIL PROTECTED]>
wrote:
> does any body now any such algorith? to find difference in days from
> YYYYMMDD to YYYYMMDD?
Once I needed the same and I wrote:
def days_difference(s1, s2):
splitdate = lambda s: time.strptime(s, "%Y%m%d")[:3]
str2date = lambda s: datetime.date(*splitdate(s))
delta = str2date(s1) - str2date(s2)
return delta.days
print days_difference("20071112", "20061029") # 379
Although I'm sure there is a better way.
arnau
--
http://mail.python.org/mailman/listinfo/python-list