Re: Date Difference issue in Python 2.7.8

2015-02-20 Thread Peter Otten
Puruganti Ramesh wrote: > I have an issue in comparing dates in python 2.7.8 No, you are stuck with parsing the dates, you don't get to the point of comparing them. > I am getting below excption > Traceback (most recent call last): > File "FunctionUpdate.py", line 204, in > dt_dateb = datetime

Re: Date Difference issue in Python 2.7.8

2015-02-20 Thread Chris Angelico
On Fri, Feb 20, 2015 at 8:32 PM, Puruganti Ramesh wrote: > import datetime as dt > from datetime import datetime > from datetime import datetime, timedelta, date The first two lines here are achieving nothing - the third should be all you need. > dt_str='2014-5-11' > dt_strq='2014-9-11' > > dt_d

Date Difference issue in Python 2.7.8

2015-02-20 Thread Puruganti Ramesh
Hi, I have an issue in comparing dates in python 2.7.8 I have written code as below but i am getting error import datetime as dt from datetime import datetime from datetime import datetime, timedelta, date dt_str='2014-5-11' dt_strq='2014-9-11' dt_datea = datetime.strptime(dt_str, '%Y-%m-%d').