-1

Please I try to convert string to Date in anyoint studio but I get this error in Avanced rest client "Cannot coerce String (22/03/2012) to Date, caused by: Text '22/03/2012' could not be parsed at index 2.

please can I some one help me . Thanks advanced .

aled
  • 21,330
  • 3
  • 27
  • 34
  • Welcome to Stack Overflow. It’s an interesting problem you’ve got there. Could you provide a [mre] so that someone can figure out what goes, please? – Ole V.V. Sep 04 '22 at 19:17

1 Answers1

0

It looks like you didn't use the right format for the conversion. You need to set the Date format if it is not the default.

Example:

%dw 2.0
output application/java
var inputString="22/03/2012"
---
inputString as Date { format:"dd/MM/yyyy" }
aled
  • 21,330
  • 3
  • 27
  • 34