Convert date time for null dates

I am getting date value via API response as string adn need to update a field in my application with the same date. The format of API field is string and i need to convert it to date. The mendix field’s datatype is date and time.   Sample date coming from API is: ‘2020-12-01 00:00:00.0’ While setting value for my mendix column MDate ,  i use: parseDateTime($API_Response/Date,'YYYY/MM/DD hh:mm:ss.s') But since date is probably null at API end, i get this error. com.mendix.modules.microflowengine.MicroflowException: Failed to evaluate expression, error occurred on line 1, character 1 parseDateTime($API_Response/Date,'YYYY/MM/DD hh:mm:ss.s') ^ dvanced stacktrace:     at com.mendix.languages.mxexpressions.MxExpressionImpl.evaluate(MxExpressionImpl.scala:32) Caused by: com.mendix.languages.expressions.ExpressionException: java.text.ParseException: Unparseable date: "null"     at com.mendix.languages.expressions.Expr.evaluate(Expr.scala:16) Caused by: java.text.ParseException: Unparseable date: "null"     at java.base/java.text.DateFormat.parse(     at com.mendix.languages.expressions.StringFunctions$.parse(StringFunctions.scala:132)     at com.mendix.languages.expressions.StringFunctions$.com$mendix$languages$expressions$StringFunctions$$parseDateTime(StringFunctions.scala:122) I also tried using this: if $API_Response/Date !=empty then parseDateTime($API_Response/Date,'YYYY/MM/DD hh:mm:ss.s') else empty   But still same error. How can this be handled.
1 answers

Try to parse the date of the field using a datetime variable and apply error handling with 'custom without rollback' to the datetime variable activity to prevent the flow falling into an exception.

If you use an import mapping to map the response to an object, you can also use a conversion flow inside the import mapping to try and convert the value to a date and return empty (or whatever you'd like) from the error handler.