That depends. Is the user going to enter Jan, Jan., January, 1, or 01 for the month?
This situation is best handled by forcing as much of the formatting as you can. For the months, generate a dropdown list of months with the option values being the months' respective two-digit numerical representation (e.g. 01 or 12 for January or December). Similarly, use a dropdown for the day, year, and hour so that you can set the two- or four-digit format you need as the option values.
Then, it's a simple matter of concatenating the submitted values together and adding ':00:00' for the minutes and second. Note that the standard datetime format doesn't have AM or PM, so if the user selects PM simply add 12 to the submitted hour value.