Specified cast not valid for datetime while using SAP RFC



I think you better use the ParseExact method available over DateTime type. It should work.

Please find the code snippet for reference −

string dateFormat = "dd.mm.yyyy hh:mm:tt";
DateTime finalDate = DateTime.ParseExact(argumentDate, dateFormat, CultureInfo.InvariantCulture);


Updated on: 2020-02-13T11:16:35+05:30

210 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements