I am writing a script where we enter two dates, one a FROM DATE and the other a TO DATE. I need to validate that difference between the two dates is always less than or equal to 60 days.
I could not find any date utility in ksh that could help me with this.
Finally, I am deciding to write a Java code and call it from the script as it is much easier and quicker to do it in Java than in Unix.
Can somebody guide me to a way in unix to do this rather than writing another script or Java or C code to do it and call it from here.
Thanks for your help.
I tried it and this is what has happened.
Franklin,
I did go through the script that you sent but I felt it is too long and big to go through for this small validation. Thanks a lot for your time and efforts though.
There is one more approach I designed myself and working on it right now.
I am creating an array that will contain number of days elapsed at the end of each month in the calendar year. Based on the month entered i can get the number of days elapsed at the end of the previous month, add it with the day of the month entered and get number of days elapsed in that year. If the difference is negative, which means the year has changed. I am hopeful that this logic will work. Once the code is ready I will paste it for others who can use it.