Convert string MM/dd/yyyy hh/mm/ss tt to datetime MM/dd/yyyy hh/mm/ss tt

36 Views Asked by At

I want to convert a string that has the format MM/dd/yyyy hh/mm/ss tt to datetime with the same format

I tried:

DateTime date = DateTime.ParseExact("05/16/2019 10/30/15 AM", "MM/dd/yyyy hh/mm/ss tt", CultureInfo.InvariantCulture);

But it returns 16/05/2019 10:30:15 instead of 05/16/2019 10/30/15 AM

0

There are 0 best solutions below