简体   繁体   中英

Convert String to date using Datawave Mule

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

尝试使用以下表达式,

foo: "2016-04-09" as :date {class : "java.util.Calendar", format : "yyyy-MM-dd"}

here we go:

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

also take a look at the documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM