akj
akj

Reputation: 21

convert MYSQL date time format to UTC time format in Mule 4

I have a requirement where I need to format the dateTime value received from MySql db to UTC time in using Mule 4 Dataweave. Example: i/p: 2021-01-20 00:00:00.0 expected o/p: 2021-01-20T00:00:00.000Z.

Upvotes: -1

Views: 682

Answers (1)

Jorge Garcia
Jorge Garcia

Reputation: 1383

What you receive from the Mulesoft Database connector is a Java SQL Date object, not a String, unless the query formats it on the DB. If you want a string representation of it, you need to format it using something like this:

myDate as String {format: "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"}

Upvotes: 1

Related Questions