How to set the Timezone for Anonymous Users?

0
Hello, I’m trying to format at date/time for CET or CEST (Europe/Berlin). I know datetimes are stored in UTC in Mendix, which is fine. Now an external service is calling my Mendix REST endpoint and receives a string that holds a date. A microflow is called to convert the mendix datetime to a string. The caller of the REST service can’t send a timezone, so the formatDateTime assumes UTC, but it should be CEST. setting the timezone in $currentUser will throw an exception specifying a timezone in formatDateTime is not possible Is any way to do this?
asked
3 answers
1

Set the desired time zone as default time zone (project settings > Runtime > default time zone), then this time zone will be used when the user hasn’t a timezone defined, which is the case for anonymous users.

answered
1

@Rene

My project is configured like this:


And in my “Published REST Service” has this configuration:


But formatDateTime(...) will Output 26.04.2021 22:00:00 instead of 27.04.2021 00:00:00.

I wonder if this is a bug?

answered
0

If it is an option to generate the date/time string on your end you can use a java action and do the formatting there.

Just have a search for java simpledateformat timezone...

answered