Skip to main content
Solved

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


Forum|alt.badge.img

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

Best answer by caracadrian

caracadrian wrote:

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

View original
Did this help you find an answer to your question?

7 replies

caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • May 4, 2023

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


Forum|alt.badge.img

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.


caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • May 4, 2023
andyreynolds wrote:

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


Forum|alt.badge.img
caracadrian wrote:

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


caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • Best Answer
  • May 4, 2023
caracadrian wrote:

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


Forum|alt.badge.img

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


caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • May 4, 2023
andyreynolds wrote:

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

Glad to be of help


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings