Question

datetimeconverter for MapInfo TAB to SHP keeping date format dd/MM/yyyy


Badge

I'm doing a simple translation of a polygon dataset from MapInfo TAB to ESRI SHP. However, there's a date field in the MapInfo table (in the TAB file it looks like: DATE_ESTAB Date ;) showing the dates as I want them dd/MM/yyyy e.g. 26/11/1990. I'm trying to use the datetimeconverter, with the output format as %d/%m/%Y and input format as Autodetect FME and ISO. In the Writer I've set the attribute Type to Date and also set an expression @DateTimeFormat(@Value(DATE_ESTAB),<%d/%m/%Y>). But the features don't get this far as all features are output through the Rejected port of the transformer.

I know I'm doing something wrong, but it looks like the MapInfo Date format isn't being recognised. When I try to use the FME Universal Translator in MapInfo, the dates come out by default as 1990-11-26 in the Shapefile, which is not what I want.

I would be grateful for any help!

Thanks


6 replies

Userlevel 1
Badge +21

If the field in mapinfo is a date format already, and the field you are writing to in the shape file is also a date format you shouldn't need to do any conversion. How the date is displayed depends on settings in the program/machine.

Badge

Many thanks for your reply. I'd hoped the transformer would be able to do the conversion - it's slightly different this morning as features aren't rejected, but the date format is still failing using various methods:

Without a transformer, but with the Writer attribute Type set to Date, but without the above Attribute Value formula, the resulting dates are as 1990-11-26. With the transformer (again without the Writer Attribute Value format formula) I get the same thing. If I add the Writer Attribute Value format formula @DateTimeFormat(@Value(DATE_ESTAB), I get the same thing. If I remove the transformer but keep the Writer formula I get the warning: "dBASE Writer: Encountered a non-date value while processing a date field on feature type 'DATE_ESTAB': '<26/11/1990>'. Ensure that fields that may contain non-date values are not marked as date type" and the field is blank.

If anyone can point me to settings I need to change somewhere, I'd be grateful, thanks.

Userlevel 1
Badge +21

Without a transformer, but with the Writer attribute Type set to Date, but without the above Attribute Value formula, the resulting dates are as 1990-11-26

 

This is nothing to do with FME, it is a setting in whatever program you are using to look at the shape file that controls how a date is displayed.

 

When writing to a date field, FME expects the date to be in the format yyyyMMdd, if you change it to dd/MM/yyyy the writer will reject the features.

 

If you want to write it so that it always displays as dd/MM/yyyy irrespective of settings you would need to write it as a text field.

 

Badge

Ah OK thanks, that makes sense. In the FME Data Inspector it displays as yyyyMMdd and I was trying to view it in QGIS so I guess yyyy-MM-dd is the default there. In MapInfo the resulting Shapefile displays correctly, the same as the reader (reflecting MapInfo settings). So the client will need to change their settings in their software at their end if it isn't displaying as they wish.

Userlevel 1
Badge +21

Ah OK thanks, that makes sense. In the FME Data Inspector it displays as yyyyMMdd and I was trying to view it in QGIS so I guess yyyy-MM-dd is the default there. In MapInfo the resulting Shapefile displays correctly, the same as the reader (reflecting MapInfo settings). So the client will need to change their settings in their software at their end if it isn't displaying as they wish.

Yes, that's correct. In QGIS you can change the setting in layer properties

Capture

Badge

Thank you.

Reply