My source dataset is DWG and destination is GDB. The source dataset has Date attributes as Char in DD-MM-YYYY. The corresponding destination attributes have to be of Date datatype, that too in M/D/YYYY format.
I tried DateFormatter transformer, with output date format string as FME Date (%D), I got the error as
The date 'FME Date (05/14/1981)' is not valid. Valid forms for a date type are YYYYMMDD, YYYYMMDDHHMMSS, or HHMMSS
For format string as %D, I got error as:
The date '05/14/1981' is not valid. Valid forms for a date type are YYYYMMDD, YYYYMMDDHHMMSS, or HHMMSS
For format string as %m"/"%e"/"%Y and %m/%e/%Y, again the above error message.
As from the error, I cannot perform the desired formation. Is there a transformer available in FME Workbench to perform desired format conversion? Or should I try something like using SubstringExtractor
and then StringConcatenator
? I need to read the documentation thoroughly to see if I can get it working.
Thanks
Best Answer
Try
%Y%m%d
,%Y%m%d%H%M%S
or%H%M%S
.Update: There seems to be two issues that the
DateFormatter
is unable to deal with:To work around both these issues I came up with the following:
The first two transformers just create a dummy test feature with a date attribute of
30-12-2011
.AttributeSplitter
creates a list out of the date by splitting it at the hyphens.AttributeExposer
makes the list elements visible as individual attributes.StringConcatenator
reorders the list elements and adds slashes, resulting in MM/DD/YYYY format.DateFormatter
then converts back to YYYYMMDD, zero-padding the month/day where necessary.The writer is a file geodatabase writer that writes a single row to a table. It runs and the output viewed in ArcCatalog is as expected: TEST_DATE is displayed as
12/30/2011
.