Transform date property during CSV Export

I have a couple date fields that I am exporting to CSV using the adapter. When I am in the backend I can see these as date strings but I think they’re actually stored in milliseconds from epoch (that’s what they output as). This means when I export to CSV the users will need to convert these to date strings in Excel. Unfortunately, Excel surprisingly doesn’t handle milliseconds to epoch natively and the users need to get a CSV that is ready to go, no formulas needed.

Is there a way that I can transform the data as part of the table2csv function in Codeless? The only options I can think of right now are:

  • use list2csv and transform the data as I load it from the DB into a list object, then save that object to CSV. Unfortunately my page size is about 1k-2k records so this means that I will have to loop through all the pages to get all of the data into the object before I can save. Probably not too hard but it seems complex and slow.
  • (Confirmed works) Create a generated column in my database that convert the stored datetime value to a string, then use that for my CSV export.

I also tried using a View and doing a transform to Data but that doesn’t seem to actually impact the value that gets written into the CSV.

Any approaches I’m not considering here?

Hi @James_Hereford,

Your approach with generated columns is probably the best option. Another option is to use an “after find” handler and inject a dynamic column with a human-readable value.

Regards,
Bohdan