1
votes

input date: "2019-09-11T14:14:00.000-05:00", need output date: "2019-09-11T14:14:00Z"

datawave code -

("noteDateTime": payload.createTimeStamp as LocalDateTime {format:"yyyy-MM-dd'T'HH:mm:ss.SSS-X"} as String {format:"yyyy-MM-dd'T'HH:mm:ss'Z'"})

is giving an output as "2019-09-11T14:01:00.000-05:00"

1

1 Answers

5
votes

As I show you in the code just use DateTime and not LocalDateTime as your temporal data does have a TimeZone and your string is already in the correct format so no need to specify any format.

%dw 2.0
output application/json
---
"2019-09-11T14:14:00.000-05:00" as DateTime as String {format:"yyyy-MM-dd'T'HH:mm:ss'Z'"}