dates pulling incorrectly from mysql, need to add one

1
this may be a simple question but i’m not sure what to do:  i have a microflow which pulls invoices from mySQL   but the dates in my datagrid are off by 1 day   typically i would write an expression however i don’t know where to put it, in the microflow or datagrid. can somebody please let me know where i could do this to correct the dates?
asked
4 answers
0

Corina, in between these  add a loop over the List of invoices. Inside the loop you can add the activity “Change Object” passing the $IteratorInvoice and setting addDays($IteratorInvoice/InvoiceDate,1)

 

Having said that, this is all fighting the symptoms. You are better of with the route that Robert and Jan are trying to send you. My addition to their advises, and to understand the DateTime that you are working with:

- set the format of your column InvoiceDate to Date and Time instead of just Date

- add a column next to it and make that show the UTC-date that you retrieved from the database.

answered
1

Hi Corina,

Displaying dates incorrect can be the result of time zones settings misconfigurations. There are serval scenarios you could check or consider:

  • Did you maybe use UTC time for writing to the datbase and not UTC when retrieving/displaying the data? or the other way around?
  • Are the dateTime attributes localized?
  • Does your project has the same Timezone configured as the project entering the dateTime values in the database?
  • Is there in the microflow a activity that execute an addDays(TIME_VALUE, 1 )?

Mendix has a full documantion on dateTime configurations: https://docs.mendix.com/refguide/date-and-time-handling/

 

Hope this helps,

Jan

answered
1

This is almost certainly down to a datetime localisation error. 

If you show the time as well as the date, you’ll probably see the time is the difference between your timezone and UTC. 

The solution is usually to not localise the time when defining the attribute in Mendix if you know the value in the database is stored in the correct local time. This should use the value from the database and not try to adjust it for your timezone. If the value has been stored in UTC then you can localise the datetime attribute so it adjusts to your timezone.

There is a useful FAQ on handling datetime correctly in Mendix.
https://docs.mendix.com/refguide/datetime-handling-faq/

answered
1

Hi Corina, 

You may try change the Attribute Date from your Entity test_Mendix_obj to Localize No.

 

 

Regards

answered