SimpleDateFormat vs Mendix formatDateTime

0
Hi I’ve noticed that if get a date member value from IMendixObject using the getValue method, convert to string using something like SimpleDateFormat, then print it, it’s off by one day, but if you use com.mendix.core.Core.evaluateExpression, pass the member into the hashmap, then use the Mendix formatDate function it prints out correctly How exactly does this work? try{ if(obj_Foo!=null){ text= com.mendix.core.Core.evaluateExpression( this.getContext(), { 'date':obj_Foo.getValue(this.getContext(),"SomeDateField") }, "formatDateTime($date, 'YYYY-MM-dd')" ) }else{ text=null; } }catch(e){ text=null; }  
asked
1 answers
2

I think this might have to do with the localization of the date field and one method takes the locale of the user into account and the other uses UTC.

You can test this by changing the simple formatter and the format datetime function to include the HH:mm option.

answered