How to get UTC timestamps from OQL

1
I'm getting some timestamps using OQL, which returns a pretty nasty format:  "Mon Dec 04 09:00:00 CET 2017" However, that's not the biggest problem. The problem is that it will always be in server time, which causes that: Locally, people get different results based on their timezone; Due to summertime, you don't know Mendix' offset to UTC and thus are unable to dynamically convert it to another timezone. The abbreviation seems rather useless in conversion, since it's not a unique identifier.   Therefore, I would really like to get the UTC timestamp, rather than in the server time zone. Any chance?
asked
1 answers
0

I had this problem with performing SQL queries as well. It turned out that there is something going wrong on the JVM. So, after I set the default time zone of the JVM to UTC it worked out fine for me.

How I did that is by adding a java action to the after startup logic with exactly one needed line of code, writing a log line, and a return statement:

TimeZone.setDefault(TimeZone.getTimeZone("UTC"));

Core.getLogger("ASu").info("default JVM time zone set to UTC!");

answered