...

compare string date to see if older

ynotlim
08-27-2010, 08:59 AM
Hi,

I have two strings with dates and want to compare to see if it's older or not.

date1 = "2010-08-08 21:20:47"
date2 = "2010-07-08 21:20:47"

if(date1 > date2):
older = True

How can i check to see if date1 is older than date2?

Thanks!

Kakao
08-28-2010, 10:22 AM
If the strings are well formed then just compare as you did but the opposite (the smaller is older):

if(date1 < date2):
older = True # date1 is older



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum