Solved

Need to extract date from DateTime field using FME but not working

  • 3 May 2023
  • 7 replies
  • 37 views

Badge

The List Date in the bottom photo contains a field called ListDate which is stored in a SQL database. 

We're using their WFS to download the data however due to the validation in Pro we can't see any date fields so we're using FME. I'm trying to use the transformer 'date time converter' but I get the prompts asking which fields I want & as you can see the software is splitting out 1 field into several which are all 'missing'. Which list elements should I select? Also in the select list elements box what number should be entered there? I just need the date so can strip out the time element. 

ListDatelist of fieldslist elementsextra columns

icon

Best answer by caracadrian 4 May 2023, 14:33

View original

7 replies

Badge +20

Based on the screenshots you added the attribute containing DateTime is called ListDate,

Not ListDate.something. FME interprets a dot as a list defining character and displays "list" elements hierarchically.

Attribute vs List

Badge

ok - thanks I have a new issue where the date time converter is rejecting single date formats which are 1-9. The dates from 10-31 are working ok or I can get 1-9 working with %b ?%e %Y however if I use the 2nd format it change all dates which are larger than 10 to single digits so need to build a else statement but am struggling.

Badge +20

ok - thanks I have a new issue where the date time converter is rejecting single date formats which are 1-9. The dates from 10-31 are working ok or I can get 1-9 working with %b ?%e %Y however if I use the 2nd format it change all dates which are larger than 10 to single digits so need to build a else statement but am struggling. 

I believe you have a double space between month and day of month for strings containing single digit months (1-9). Just put a StringReplacer in front of DateTimeConverter to replace double space with single space

"  "-> " "

After replacing, %b %e %Y %H:%M%p as input should work

Badge

I believe you have a double space between month and day of month for strings containing single digit months (1-9). Just put a StringReplacer in front of DateTimeConverter to replace double space with single space

"  "-> " "

After replacing, %b %e %Y %H:%M%p as input should work

So like the below? I need the output to be DD/MM/YYYY datetime2

Badge +20

I believe you have a double space between month and day of month for strings containing single digit months (1-9). Just put a StringReplacer in front of DateTimeConverter to replace double space with single space

"  "-> " "

After replacing, %b %e %Y %H:%M%p as input should work

No. In front of DateTimeConverter put a StringReplacer transformer.

Text to replace double space (press the space bar 2 times), Replacement text single space (press the space bar a single time).

StringReplacer double space

Badge

Thanks very much I would never have thought of that & it works :)

Badge +20

Thanks very much I would never have thought of that & it works :)

Glad to be of help

Reply