Check the format of Date

Hi,

I have a date field in my input file.
I just want to check if its in the format "DD-MM-YYYY".
Is there any command which can achieve this?

Thanks and Regards,
Abhishek

The is no standard command that you can use that I know of.

There are many shell scripts available. Google finds a number of them
Here is a pointer to one:

Validate date - ITtoolbox Groups

thanks,

There is a shorter way to check the date validity.
First extract the date, month and year components from the date and then use the following command to check the date validity.

cal $monthValue $yearValue| tr -s " " "|" | tr -s "\n" "|" | grep $dateValue

before running this command truncate the leading 0 in date
dateValue=`expr $dateValue + 0 2>/dev/null`

Regards,
AAA