You can e.g. use the following in a PythonCaller:
import fmeobjectsimport datetimedef monthrange(start, finish): months = (finish.year - start.year) * 12 + finish.month + 1 for i in range(start.month+1, months-1): year = (i - 1) // 12 + start.year month = (i - 1) % 12 + 1 yield datetime.date(year, month, 1).strftime('%m') def FeatureProcessor(feature): start = str(feature.getAttribute('start_date') or '') end = str(feature.getAttribute('end_date') or '') start_dt = datetime.datetime.strptime(start, '%Y%m%d') end_dt = datetime.datetime.strptime(end, '%Y%m%d') feature.setAttribute('months{}', list(monthrange(start_dt, end_dt)))
Assuming the input attribute start_date and end_date on the FME format %Y%m%d, it will return a list months{} containing all the month numbers between the two dates, the months of the start and end date not inclusive. Be careful about what happens when you roll over to a new year.
Here's also a workspace template for FME 2019.2.2: monthrange.fmwt