0

I want to convert a string "2016-04-09" to a date using datawave mule , any idea guys ?

When i use :

%dw 1.0
%output application/json
---
{
  d1: "2016-04-09" as :date
}

i got SUN Mar 09 00:00:00 CET 2016 as result but i want '2016-04-09' date type instead

2 Answers 2

1

Try using the following expression,

foo: "2016-04-09" as :date {class : "java.util.Calendar", format : "yyyy-MM-dd"}
Sign up to request clarification or add additional context in comments.

Comments

0

here we go:

%dw 1.0
%output application/json
---
{
    foo: "2016-04-09" as :date
}

also take a look at the documentation.

1 Comment

the output is not that what i want :( , i got a result like this " SUN Mar 09 00:00:00 CET 2016" but i want a result like this " 2016-04-09" type date not string

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.