If your date formats are static, you have two easy options.
Option 1
- Strip out the day, month, and year from each date.
- Compare the two years.
- If the years are the same, compare the two months.
- If the months are the same, compare the two days.
Option 2
- Strip out the day, month, and year from each date.
- Create a new date string in the YYYY-MM-DD format
- Do a standard string comparison on the two resulting strings.
I’m sorry, but I’m not in a position to provide you with sample code at this time.
1
solved How to compare date in linux for specific format