How to combine two strings (date and time) to a single DateTime
Your issue is with your hour specifier; you want h
(The hour, using a 12-hour clock from 1 to 12), not HH
(The hour, using a 24-hour clock from 00 to 23).
Try like this;
string one = "13/02/09";
string two = "2:35:10 PM";
DateTime dt = Convert.ToDateTime(one + " " + two);
DateTime dt1 = DateTime.ParseExact(one + " " + two, "dd/MM/yy h:mm:ss tt", CultureInfo.InvariantCulture);
Console.WriteLine(dt1);
Here is a DEMO.
HH using a 24-hour clock from 00
to 23
. For example; 1:45:30 AM -> 01
and 1:45:30 PM -> 13
h using a 12-hour clock from 1 to 12. For example; 1:45:30 AM -> 1
and 1:45:30 PM -> 1
Check out for more information Custom Date and Time Format Strings