Display of localized DateTime in a different timezone.

Hi all, I am working on a project which is used in multiple timezones and I can't wrap my head around a localized view of a DateTime attribute. Can someone please explain? Thanks in advance!   Imagine two users: user 1 is in the Netherlands and has user timezone (GMT +01:00) Amsterdam. User 2 is in Canada and has user timezone (GMT -08:00) Vancouver. We are currently in daylight saving time (Amsterdam = UTC +02:00, Vancouver = UTC - 07:00). User 1 sets the value of a localized DateTime attribute to BeginOfCurrentDay. The attribute has these values: UTC time: 2017-09-25 22:00:00.000 Session time: 2017-09-26 00:00:00.000 +0200 A view of the attribute in the session of user 1 shows 2017-09-26 12AM, as expected. Now user 2 logs in and observes the DateTime attribute. The attribute has these values: UTC time: 2017-09-25 22:00:00.000 Session time: 2017-09-25 15:00:00.000 -0700 A view of the attribute in the session of user 2 shows 2017-09-26 12AM. This is not what i expect at all! I expect the value to be shown as 2017-09-26 3PM. Why does the view show 12 AM instead of 3PM? Four additional notes: The default 'Export grid to Excel' button generates a file in which the DateTime DOES show 2017-09-26 3PM. A formatDateTime also results in 2017-09-26 3PM I figured this might have something to do with the DatePicker widget. To verify this, I also created a button which invokes a microflow that sets the attribute to BeginOfCurrentDay. A localized view of this value also shows 2017-09-26 12AM. I log in with both user 1 and user 2 on my laptop with OS timezone set to (GMT +01:00) Amsterdam.  
2 answers

Hi Koen,

I believe the display of a localized date-time attribute is controlled by the Browser -- since your browser is listed in GMT+1:00, it will always display the localized attributes in that manner.  If you change your OS time zone then you should see the date-times that you're looking for.

Setting the timezone for an account, I believe, affects how the data is interpreted on the server.  When you run a microflow and it references the localized datetimes you're referring to, you should see the "Session time:" portion equivalent to the time zone that you set for the account.  The "Export to Excel" functionality is completed by the Mendix Business Server, I'm guessing, and that is why you see the "properly" formatted date-times in the excel sheet.


When working with different timezones this part of the documentation is a must read: https://docs.mendix.com/refguide/datetime-handling-faq

But as stated it is the browser that influences the way how the date / time is shown. In the database everything is in UTC.