Re: confused on calculating date difference in days.

2007-10-16 Thread Shane Geiger
# Example import datetime def days_old(birth_year=1974,birth_month=12,birth_day=7): return (datetime.date.today() - datetime.date(birth_year,birth_month,birth_day) ).days >>> days_old() 12000 krishnakant Mane wrote: > hello, > thanks all of you for providing valuable help. > right now I am

Re: confused on calculating date difference in days.

2007-10-16 Thread Diez B. Roggisch
krishnakant Mane wrote: > hello, > thanks all of you for providing valuable help. > right now I am confused about the delta object. > how can I extract the difference between two dates in terms of day > using the delta object? > I tried reading the python docs but did not understand the concept of

Re: confused on calculating date difference in days.

2007-10-16 Thread krishnakant Mane
hello, thanks all of you for providing valuable help. right now I am confused about the delta object. how can I extract the difference between two dates in terms of day using the delta object? I tried reading the python docs but did not understand the concept of delta object and how can I measure t

Re: confused on calculating date difference in days.

2007-10-16 Thread Marc 'BlackJack' Rintsch
On Tue, 16 Oct 2007 18:10:54 +1000, Ben Finney wrote: > Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > >> On Tue, 16 Oct 2007 12:33:33 +0530, krishnakant Mane wrote: >> >> > firstly, I can't get a way to convert a string like "1/2/2005" in >> > a genuan date object which is needed for ca

Re: confused on calculating date difference in days.

2007-10-16 Thread Ben Finney
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > On Tue, 16 Oct 2007 12:33:33 +0530, krishnakant Mane wrote: > > > firstly, I can't get a way to convert a string like "1/2/2005" in > > a genuan date object which is needed for calculation. > > Why? Split the string up, convert the parts to

Re: confused on calculating date difference in days.

2007-10-16 Thread Ben Finney
"krishnakant Mane" <[EMAIL PROTECTED]> writes: > firstly, I can't get a way to convert a string like "1/2/2005" in a > genuan date object which is needed for calculation. Until recently, this was a wart in the Python standard library: datetime objects exist in the 'datetime' module, but parsing s

Re: confused on calculating date difference in days.

2007-10-16 Thread Marc 'BlackJack' Rintsch
On Tue, 16 Oct 2007 12:33:33 +0530, krishnakant Mane wrote: > firstly, I can't get a way to convert a string like "1/2/2005" in a > genuan date object which is needed for calculation. Why? Split the string up, convert the parts to `int` and just create a `datetime.date` object. > now once this

confused on calculating date difference in days.

2007-10-16 Thread krishnakant Mane
hello, I am strangely confused with a date calculation problem. the point is that I want to calculate difference in two dates in days. there are two aspects to this problem. firstly, I can't get a way to convert a string like "1/2/2005" in a genuan date object which is needed for calculation. now o