How to format date and time to a specific time zone in Mule

Let us see how to convert the timestamp or set the date and time to a specific time zone using Dataweave in MuleSoft. Below is an example that converts the current timestamp to a specified time zone "GMT". The format is also specified which can be updated as per your desired date & time format.

Also read: For a list of date-time format examples using Dataweave




Dataweave code:
%dw 2.0
output application/json
---
((now() >> "GMT") as String {format: "MMM dd, uuuu, KK:mm:ss a"})



Post a Comment

0 Comments