2
I have a variable that contains a date with AM/PM:
string data = "01/08/2016 9:00 PM";
When I try to convert to DateTime
using the method TryParse
the result ignores the designator "AM/PM".
string data = "01/08/2016 9:00 PM";
DateTime dataOut;
if(DateTime.TryParse(data, out dataOut))
{
//Restante do código.
dataOut.ToString(); //Retorna 01/08/2016 09:00, deveria retornar 21:00.
}
How to proceed? What method do I use to perform this conversion, taking into account the AM/PM?