Read my free-form date

PowerShell, 91 89 91 56 bytes

date("$args"-replace'th|rd|st|(\b.*)day|,')-f yyyy/MM/dd

Try it online!

Takes input as a string. Uses a -replace to get rid of junk, then uses the built-in Get-Date command with the -format flag to specify the required yyyy/MM/dd format. That string is left on the pipeline and output is implicit.

Saved two bytes thanks to Mr Xcoder. Saved a huge chunk thanks to TessellatingHeckler's regex golfing.


PHP, 73 164+1 bytes

for(preg_match("#(\d+)[^\d]+(\d+)#",$d=$argn,$r);$m++<12;)strpos(_.$d,date(F,strtotime($r[2].-$m)))&&printf(checkdate($m,$r[1],$r[2])?"$r[2]/%02d/%02d":E,$m,$r[1]);

Run as pipe with -nR or try it online.

The date check was really expensive: I had to disassemble the date before using a builtin, then try and error on the month name.


Rails, 41, 37 35 bytes

->x{x.to_date.strftime('%Y/%m/%d')}

I don't know of an online interpreter for Rails, but here is a screenshot demonstrating this proc

enter image description here