Conversion of String to Date Type

Anna Martelli Ravenscroft anna at aleax.it
Fri Sep 17 15:40:40 EDT 2004


On Fri, 17 Sep 2004 11:19:12 -0700, Keith Bolton wrote:

> Hello All,
> 
> I've joined the wxPython list, but this is my first post on the python
> list and it's good to be here :^)  Anyway...
> 
> My question is relating to Date equality.  I am checking if two string
> representations of dates are less than or equal to eachother. The issue
> that I am having is that the date strings, ex. 09/15/04 is evaluated as
> > 09/14/04.  However, when the last two digits for the year are changed,
> like this 09/15/04  is considered > 09/15/05. I thought this had
> something to do with evaluating two strings.  Could this be the case, if
> so does someone know of a way to convert those strings into a Date type
> object?

Check out dateutil's fuzzy parser. It's great for handling this sort of
thing.

https://moin.conectiva.com.br/DateUtil#head-fe951d30a583390a274f57d3e881611e5ae207a5

HTH
Anna



More information about the Python-list mailing list