如何在 dataweave 2.0 中将 twitter created_at 转换为日期时间?

How to convert twitter created_at to datetime in dataweave 2.0?

twitter 返回的日期

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

期望的输出

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

您好@Imran Qamer 您可以使用此转换:

%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"}