Incorrect date time from local to UTC saved in database
I'm looking for some help in resolving a data issue that I'm having. I have a REST service that receives a date as a string. I’m parsing that string into a date field with: parseDateTime(substring($Header/transTms,0,10),'yyyy-MM-dd') I was originally accepting the date as a date variable, but was having the same issue. The wrong UTC time was being applied or zeroed out. I was expecting my local time to be applied and converted to UTC. This hasn’t been the case and I’m getting UTC time of zero when it should be 03:00 or 04:00. The result is that the wrong date is saved in the database breaking my data. When I check the data, this is what I’m seeing. UTC time: 2019-05-13 00:00:00.000 Session time: 2019-05-13 00:00:00.000 +0000 I've reviewed the Mendix forums without much success and https://docs.mendix.com/refguide/date-and-time-handling wasn't overly helpful. I'm not sure what I'm missing, but it seems like my option is to change all my date variables to strings, which I'd prefer not to.
Is this rest service called in user context? if yes, I would expect the same as you. If it runs in system context, there is no local time and the behavior you see is what i would expect.