Getting most two recent date
Using PostgreSQL this is pretty easy. The input formats support this form, and you can sort easily and limit to the two most recent dates.

SELECT mydate
FROM ( VALUES
  ('Jan 01,2017'::date),
  ('Mar 02, 2017'),
  ('Feb 09,2017'),
  ('Jun 02,2017')
) AS t(mydate)
ORDER BY mydate DESC
LIMIT 2;


If some of those dates are ahead of the current date, you may want to add some selectivity,

SELECT mydate
FROM ( VALUES
  ('Jan 01,2027'::date),
  ('Jan 01,2029'),
  ('Jan 01,2017'),
  ('Mar 02, 2017'),
  ('Feb 09,2017'),
  ('Jun 02,2017')
) AS t(mydate)
WHERE mydate &lt;= CURRENT_DATE
ORDER BY mydate DESC
LIMIT 2;