String to date parsing incorrectly (Seems to add +1 day)

0
I'm importing an XML files into my application. This XML file has 3 dates (start date, ETD and due date). The XML has these dates listed as below: <?xml version="1.0" encoding="UTF-16" standalone="no"?> <revitproductionline> <ProductionLines> <DueDate>20-11-14</DueDate> <StartingDate>01-06-14</StartingDate> <ETD>20-10-14</ETD> </ProductionLines> In order to map these to my domain model (which uses date time attributes) I have to convert these to datetimes if i'm correct. I have used parseDateTime($DueDate,'dd-MM-yy',dateTime(2007)) for a while and it worked fine, however I just checked into it and it seems to (sometimes?) add +1 to the days for the Due date and the ETD but not for the starting date (which is weird because they all use the same parsing microflow). So for example 02-02-15 gets imported as 03-02-15. Anybody has any ideas why this could happen (or knows another/better way to do this import)
asked
1 answers
1

It is really not so strange. Check the way you store the date in Mendix. Is the date attribute set to localize yes or no? My guess it is set to standard (Yes). This means that when you create a date it will localize this date and store it. So when creating a date for 22-10-2014 in the Netherlands timezone Mendix will store an UTC date. And since the localize date is 22-10-2014 00:00 hours it will substract two hours and store the UTC date of 21-10-2014 22:00 hours. It does not matter if you do need the time, because Mendix will store it anyway.

If you want only the date make sure that the attribute is set to localize no and make sure that you do everything in UTC. This way you can avoid these issues.

Also make sure that you read this: https://world.mendix.com/display/refguide4/DateTime+handling+FAQ

Regards,

Ronald

answered