user3165854
user3165854

Reputation: 1655

Force date time to time zone when setting variable using Mule expression language

I am using Anypoint Studio 6.1 and Mule 3.8.1 and I want to set a variable with todays date and time e.g. Thu, 2 Mar 2017 22:00:28 GMT but the variable is set it is being set as Thu, 2 Mar 2017 22:00:28 UTC. How can I force it to show in GMT in the application as I cannot change server settings for this?

My MEL expression that does this is:

#[server.dateTime.format("EEE, d MMM yyyy HH:mm:ss z")]

Thanks

Upvotes: 0

Views: 2732

Answers (2)

Satheesh Kumar
Satheesh Kumar

Reputation: 797

This can be helpful just a forum blog post.If you are looking for MEL the above answer would be enough

https://support.mulesoft.com/s/article/ka434000000TOwlAAG/How-to-properly-set-the-TimeZone-in-Mule-Mule-Runtime-and-CloudHub

Upvotes: 1

Errol Carrasco
Errol Carrasco

Reputation: 261

Here's the MEL you need on that scenario:

[server.dateTime.withTimeZone('GMT').format('EEE, d MMM yyyy HH:mm:ss z')]

Upvotes: 1

Related Questions