I have some SAP dates with EEE MMM dd HH:mm:ss zzz yyyy
format. For example, Mon Sep 02 00:00:00 BST 2019
. I need to transform it to dd/MM/yyyy
using dataweave 2.0, but until now I had no sucess.
I thought that this transformation might run well, but it isn't:
%dw 2.0
output application/json
---
{
timestamp: "Mon Sep 02 00:00:00 BST 2019" as LocalDateTime {format: "EEE MMM dd HH:mm:ss zzz yyyy"} >> "BST" as String {format: "dd/MM/yyyy"}
}
The data I have to transform is a little bit more complex:
[
{
"id": 1,
"timestamp": "Tue Jan 06 00:00:00 BST 2000"
},
{
"id": 2,
"timestamp": "Sun Dec 05 00:00:00 BST 2015"
},
{
"id": 3,
"timestamp": "Mon Oct 04 00:00:00 BST 2017"
},
{
"id": 4,
"timestamp": "Sat Jul 03 00:00:00 BST 2020"
},
{
"id": 5,
"timestamp": "Mon Sep 02 00:00:00 BST 2019"
}
]