Reputation: 37
Please help me transforming the date-format from
"Mon, 26 Sep 2022 14:51:04 +0000"
to this format
"2022-09-26"
Thanks
Upvotes: 0
Views: 95
Reputation: 26
You must read your input in the incoming format, then you can transform your input to the desired format, here is an example of how you can achieve that,
%dw 2.0
output application/json
var inputDateTime = "Mon, 26 Sep 2022 14:51:04 +0000"
var myDateTime = inputDateTime as DateTime {format: "E, dd MMM yyyy HH:mm:ss Z"}
---
myDateTime as String {format: "yyyy-MM-dd"}
I recommend you go over the documentation pages, for a better understanding of dates formatting in DataWeave 2,
Upvotes: 1