Skip to main content

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

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


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


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

Aaron


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...


An alternative solution would be to use the AttributeValueMapper.


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.


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.


FYI, the images are broken...

TY, re-uploaded the attachments.


Reply