1

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

1 Answer 1

1

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:

  1. Hyphens, and
  2. Days before months in numeric formats, such as 30/12/2011.

To work around both these issues I came up with the following: FME Workbench screenshot

The first two transformers just create a dummy test feature with a date attribute of 30-12-2011.

  • The AttributeSplitter creates a list out of the date by splitting it at the hyphens.
  • The AttributeExposer makes the list elements visible as individual attributes.
  • The StringConcatenator reorders the list elements and adds slashes, resulting in MM/DD/YYYY format.
  • The 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.

11
  • @bhah238: Read my question please. I need date to be in M/D/YYYY format only.
    – Kumar Kush
    Dec 12, 2011 at 18:16
  • 2
    It should work. Try it if you haven't. Dates in geodatabases are stored as YYYYMMDDHHMMSS, though they are formatted according to your date/regional settings when displayed.
    – blah238
    Dec 12, 2011 at 18:48
  • Actually there seems to be two issues that the DateFormatter is unable to deal with: 1) Hyphens and 2) days before months in numeric formats. There's probably a few ways to work around this, I'll update my answer if I can figure it out.
    – blah238
    Dec 12, 2011 at 19:19
  • Updated answer, see if this works for you.
    – blah238
    Dec 12, 2011 at 20:05
  • Thanks. Transformation did take place, but I think I messed-up somewhere. I used the input date string in AttributeCreator as 21-6-1984,but got the output in GDB as 21-06-1984. The problem seems to with StringConcatenator since in its output, it shows both Destination Attribute as well as the parts of the date fields as produced by the AttributeExposer. And hence the DateFormatter shows the same fields as StringConcatenator. By the way, what date format string should I use in DateFormatter?
    – Kumar Kush
    Dec 12, 2011 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.