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.
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'"}