How to convert twitter created_at to datetime in dataweave 2.0?

Viewed 173

Date returned by twitter

"created_at": "Tue Sep 14 23:57:15 +0000 2021",

Desired Output

"created_at": "2021-09-14 23:57:15",
1 Answers

Hi @Imran Qamer You can use this transformation:

%dw 2.0
output application/json
---
payload.created_at as DateTime {format: "E MMM dd HH:mm:ss Z yyyy"} as DateTime {format: "yyyy-MM-dd HH:mm:ss"}

enter image description here

Related