Skip to main content
Solved

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

  • May 3, 2023
  • 7 replies
  • 373 views

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

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

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

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

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

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

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

Glad to be of help