简体   繁体   中英

Date conversion in Mule

I am getting the date as below

2022-10-25 11:00:00

which I need to convert to

2022-10-25T11:00:00

Please let me know the appropriate data weave to achieve the above output.

@subhash,

you can try adding the letter "T" to the input string and then convert the whole string into DateTime as shown below.

*%dw 2.0 output application/json

(payload replace " " with "T") as DateTime*

%dw 2.0
output application/json
var data = "2022-10-25 11:00:00"
---
data replace  " " with "T"

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