how to get time of different timezones.

0
Hi, I have a requirement where I need to display timings of different timezones of the world using timezone parameter, can someone help me out how this can be achieved. Is there any inbuilt functionality in mendix? Thanks
asked
3 answers
2

You could create a java action "FormatDateTimeWithTimeZone” that converts a DateTime to any time zone:

TimeZone tz = TimeZone.getTimeZone(timeZone);
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
sdf.setTimeZone(tz);
String result = sdf.format(date);

It takes parameters timeZone (string), pattern (string) and date (DateTime).

answered
0

You can use a non-localized timezone and add or subtract hours to that using a calculated field for example. But messing with time zones is always tricky..

answered
0

As addition to Jop’s answer. DatTime is always stored UTC. When set localize to true, it will be converted to the user client timezone when viewed automatically. When you want to show the same value to the same user at the same time with a different time zone, then set localize to false.

In the System module you’ll find the TimeZone entity, which contains the raw offset of the TimeZone. This offset can be used to calculate and display the DateTime value in multiple timezones

answered