Skip to main content
5 of 9
deleted 27 characters in body
AZTECCO
  • 10.9k
  • 1
  • 15
  • 58

Ruby, 99 89 149 bytes

->y,m{(a=(Date.new(y)..Date.new(y,m,-1)).reject{|d|d.sunday?|d.saturday?}[-1]).strftime("%A %-d")+([1,"st","nd","rd"][a.day%10]||"th")}
require'time'

Try it online!

Fixed restricted output at huge cost.

Never thought Ruby had ranges also for dates!

Explanation

Anonymous function tacking year and month as numbers.

We pass the [First day of year .. last day of month(-1)] range and reject Sundays and Saturdays.

We return the last element.

AZTECCO
  • 10.9k
  • 1
  • 15
  • 58