Store all dates in $ctime format. Thjat gives you numerical values like 1069011298 for Sun Nov 16 20:35:03 2003. You can use mathematical functions and if statements on that.