I consider these comments slightly off-topic, but highly relevant. Three types of error are common in dates input by users. ('.' or '-' rather than '/'. 2-digit rather than 4-digit years. and fields out of order) Use of such dates in a simple compare can lead to wrong results with no indication of error. Testing for the first two is so easy that there is simply no reason not to do it. It is not always possible to detect the third. The best that you can do is to verify that the date is valid and in a range that is "reasonable" for your application. Without modules, this may be more trouble than it is worth. A possible compromise is to verify that the month is less than 13 and the day is less than 32. This would detect about half of the errors and never reject a valid date.