Date and String Objects.

Hello all,

I sent this message to the python mailing list, but haven't gotten a
response yet. However, my question could easily be answered by someone
here:

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?

Thanks for your feedback,

Keith Bolton

String comparison per se doesn't understand dates or the
conventions of various date formats. The easy way would be to use
yyyy-mm-dd, which automatically is sorted correctly by the string
comparison. If you must use mm/dd/yy, then you will have to parse
it using mx.DateTime, or the Python time or datetime modules or the
dateutils module recommended on this list not so long ago.

Donnal Walter
Arkansas Children's Hospital

ยทยทยท

--- Keith Bolton <Keith.Bolton@batescapital.com> wrote:

My question is relating to Date equality. I am checking if
two string representations of dates are less than or equal to
each other. 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?