0
votes

We have one requirement where we need to check whether the input date is valid UTC format or not, if not we need to append zeroes to it. We are trying to implement in DW since it is the part of complex logic. but we are not able to convert and validate the date in DW. could you please help. %dw 1.0 %output application/java

%var d= "2013-10-13T01:37:56" as :date

{ endDate:"" when (d == null or d == "") otherwise ( d when ( d is :date {format: 'yyyy-MMM-ddHH:mm:ss'}) otherwise (d as :date {format: "yyyy-MM-dd'T'HH:mm:ss"}) )

} Thanks Sushma

1

1 Answers

0
votes

Please use :datetime format in your input variable and also in output as time is appended to date.

endDate : (payload.d as :datetime {format: "yyyy-MM-dd'T'HH:mm:ss"} >> "UTC")

This converts the datetime to UTC always.