I am getting 2 strings back from an API one for the date, and one for the time. I need to convert the 2 of them into a single DateTime object with the date and time in it. the 2 strings I get back are
Date: "2017-10-17"
Time: "8:00PM"
Below is what I am trying to do and I can not get it to work. If I remove the time from it I can parse just the date, but I cant seem to figure out the pattern to add the time in it.
string date = "2017-10-17";
string time = "8:00PM"'
string startTime = $"{date} {time}";
DateTime date = DateTime.ParseExact(startTime, "yyyy-MM-dd hh:mmtt", System.Globalization.CultureInfo.CurrentCulture);
How can I get those 2 strings to combine into a single DateTime object?