Skip to main content
Solved

Want to convert 3 character month to 2 digit month


aaron
Contributor
Forum|alt.badge.img+10
  • Contributor

I am trying to convert a three character month to a two digit month (e.g. - Mar to 03) using FME 2016.1 (build 16492). Should be easy enough using the DateFormatter but the converted value returned is always 01. I think my parameters are set up correctly. Screenshot attached. Any ideas?

Thanks,

Aaron

Best answer by ebygomm

I think the DateFormatter in 2016 only works on dates, so you can convert 01-Jan-2018 to 01-01-2018 but not just the Jan element on it's own.

There are a number of other ways to convert the months to their numeric values if it's just months with no day and year, e.g. attributevaluemapper

Or appending next in front of your 3 letter month and putting that through the date formatter using auto as the source will work too

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

8 replies

chrisatsafe
Contributor
Forum|alt.badge.img+2
  • Contributor
  • January 8, 2019

Hi @aaron,

Not sure why the DateFormatter isn't giving you the correct output but it works with the DateConverter using the following parameters:

Input

Output

Here is a sample workspace: 2016.1_DateConverter.fmwt


ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • Best Answer
  • January 8, 2019

I think the DateFormatter in 2016 only works on dates, so you can convert 01-Jan-2018 to 01-01-2018 but not just the Jan element on it's own.

There are a number of other ways to convert the months to their numeric values if it's just months with no day and year, e.g. attributevaluemapper

Or appending next in front of your 3 letter month and putting that through the date formatter using auto as the source will work too


aaron
Contributor
Forum|alt.badge.img+10
  • Author
  • Contributor
  • January 8, 2019

Thanks @egomm and @ChrisAtSafe, both of your solutions work. I appreciate it!

Aaron


david_r
Celebrity
  • January 9, 2019
chrisatsafe wrote:

Hi @aaron,

Not sure why the DateFormatter isn't giving you the correct output but it works with the DateConverter using the following parameters:

Input

Output

Here is a sample workspace: 2016.1_DateConverter.fmwt

FYI, the images are broken...


david_r
Celebrity
  • January 9, 2019

An alternative solution would be to use the AttributeValueMapper.


jkr_wrk
Influencer
Forum|alt.badge.img+29
  • January 9, 2019
david_r wrote:

An alternative solution would be to use the AttributeValueMapper.

This would be my choice for this kind of problem. But the DateConverter could be more robust because it can deal with oct,Oct,10,okt differentiations.


david_r
Celebrity
  • January 9, 2019
jkr_da wrote:

This would be my choice for this kind of problem. But the DateConverter could be more robust because it can deal with oct,Oct,10,okt differentiations.

Yes, it would absolutely depend on the input data.


chrisatsafe
Contributor
Forum|alt.badge.img+2
  • Contributor
  • January 9, 2019
david_r wrote:

FYI, the images are broken...

TY, re-uploaded the attachments.


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