[Solved] How to compare date in linux for specific format


If your date formats are static, you have two easy options.

Option 1

  1. Strip out the day, month, and year from each date.
  2. Compare the two years.
  3. If the years are the same, compare the two months.
  4. If the months are the same, compare the two days.

Option 2

  1. Strip out the day, month, and year from each date.
  2. Create a new date string in the YYYY-MM-DD format
  3. 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