I have a variable as property like this:
DateTime? something;
something  = Convert.ToDateTime(d1);
where d1 = '04/20/2020 12:50 PM';
I get a runtime error:
String was not recognized as a valid
datetime
Then I tried this code:
something  = DateTime.TryParseExact(d1, "MM/dd/yyyy HH:mm tt", null);
and get a compile time error:
No overload for method 'TryParseExact' takes 3 arguments
Then I tried to convert it like by below too
something  = DateTime.TryParseExact(d1, "MM/dd/yyyy HH:mm tt", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dt);
and got another compile-time error:
Cannot implicitly convert type
booltoSystem.DateTime?
How to convert nullable datetime to getting datetime format?

 
     
     
     
    