Display DateTime in one specific timezone irrespective of users location

1
Hi, I’m trying to display DateTime in one specific timezone irrespective of user's location. For this, I set Pacific timezone as default setting in my project. Also I set the same timezone for the user in Accounts entity. Now I try to save current datetime in database and when I try to display it then Singapore time is displayed because I am in Singapore and the same is set in the browser. I think its always picking up the timezone of my browser, probably because in the entity I have set Localize ON for the datetime field. But if I turn it OFF then UTC time is displayed. All I want is to display time in PST forever. My requirement is to store the current datetime in UTC format in database, but always display the time to the user in pacific time (no matter where the user is located) I’d appreciate some help on this. Thanks.
asked
6 answers
1

See the documentation here: https://docs.mendix.com/refguide/datetime-handling-faq

Per attribute of type Date and time you can specify whether you want the date and time to be localized. Both localized and non-localized attributes are stored in UTC but only localized attributes are shown in the time zone of the user when displaying (or picking) their value, for example in the client or in generated documents.

Regards,

Ronald

 

answered
0

Set the default time zone in Settings/Runtime

answered
0

Ankur Vig,

 Hi...You can set default time zone under project Security….>Runtime tab.

answered
0

Anybody has got any other idea to solve this issue?

answered
0

Hi @Ankur vig,

We have similar requirement in our app, 

Below is the solution we have done.

We created 2 attributes - 1 with localization ON another with Localization OFF.

When user selects Date/Time - we will always capture it in 1st attribute and we will display a message to the user what is the local time and what is the UTC time.

We kept an onchange microflow for the first attribute and we always convert the time that user selects in First field with the timezone that we need and storing it in attribute2.

We wrote one Java action to change the selected time to a timezone and calling it in the OCH microflow of first attribute.

 

Regards

Ajay

answered
0

Anybody found solution for this? we are looking for similar kind of solution.

 

Thanks in Advance

 

answered