Hi,

I have a date with the String like "20091128' and we have to check this date with current date ("20101118"). if that date is old then we need to do some rules. I've checked in google whether there any existance but there have different formats. Can anyone give me the clue to compare them.

Convert to datetime.date and you can then compare for greater or lesser than.

Use string order

>>> "20091128" < "20101118"
True

This will work for all dates with 8 characters.

edit: to avoid the Y10K syndrome, choose woooee's solution :)

commented: Far thinking scientist (7990 years to be exact) +2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.