Converting datetime format without using SAP RFC with C# -


i got problem when trying convert date-time format sap rfc.

i'm trying this:

string tmpdate = argdate.tostring("dd.mm.yyyy"); datetime date = convert.todatetime(tmpdate);  irfcfunction saprateapi = null; saprateapi = _ecc.repository.createfunction("zrfc_cust_condition_rate");  saprateapi = createsaprateapi(saprateapi, argpartnersaptrancode, argcustsaptrancode, argmaterialcode, date); saprateapi.invoke(_ecc); 

but getting error 'specified cast not valid'

consider using datetime.parseexact method.

  // parse date , time custom specifier.   string format = "dd.mm.yyyy hh:mm:tt";   datetime date;   try {      date = datetime.parseexact(argdate, format, cultureinfo.invariantculture);   }   catch (formatexception e) {      throw new argumentexception("argdate", e);   } 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -