How to use ParseDateTime ??

0
i need to create object using csv in the csv there is a column create_date im using create object to input the csv data into the entity im using ParseDateTime to input my datetime for create object because i have to import csv data to nonPersistent entity first and it all have to be string,,, but for one cell example the csv create_date has “2023-07-05 21:00:30” but in mine it got imported as “1970-07-07 00:00:00”,, how to resolve this ??? 
asked
1 answers
0

I always recommend a three step approach

  1. Flat import (no conversion or changes)
  2. Transform data and enrich data (eg parse to date, convert string in to enum_value, associate to required objects). In your case this could mean that you would have two attributes in your entity. 1) create_date_string, that you use for your import and 2) create_date_datetime, that you use for parsing.
  3. Process data to the required structure.

That way you have full control and you can check the independent steps. My guess is that the value would be imported correctly as a string, but somehow the format you use is not correct (common mistakes are using mm (minutes) in stead of MM (month).


Please refer to https://docs.mendix.com/refguide9/parse-and-format-date-function-calls/ for more information on the subject. 

answered