Skip to main content
4 of 9
added 186 characters in body
AZTECCO
  • 10.9k
  • 1
  • 15
  • 58

Ruby, 99 89 # Ruby, 157 bytes

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

Try it online!

+68 Bytes to fix restricted output

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