[Solved] Convert text date format to date format


Sub datestuff()
    myDate = "22nd July 2016"
    myDateArray = Split(myDate, " ")
    myDateArray(0) = Trim(Replace(Replace(Replace(Replace(myDateArray(0), "st", ""), "nd", ""), "rd", ""), "th", ""))
    myDate = DateValue(Join(myDateArray, " "))
    Debug.Print myDate ' outputs '22/07/2016'
End Sub

Seems to me the main issue is the day part; handle that and the rest will be simple enough?

solved Convert text date format to date format