Compare months

I’m working on a dataset with invoice data.

I have two data fields with dates in it, an invoice date and a GL date. I would like to compare whether the dates are in the same month.

As a next step I want to filter out the invoices that have different month values.

I tried using the time difference node, but that doesn’t work to my needs as in the example below it result in a value of zero months difference while I would need to see that it’s a different month.


  1. Invoice date = 2023-08-31
  2. GL date = 2023-09-01

Using days to calculate the difference also doesn’t work, because if the dates would only differ 1 day as well but in the middle of the month it will show a difference, while it’s OK for me.

Of course I can extract the month field from both field and compare them, but I’m hoping there’s a more effective way…?

Hi @robvp ,

you can use the Date&Time to String – KNIME Community Hub node with format “yyyy-MM” to get an identifier of the month and compare based on that.

Hope this helps,


Thanks! That’s probably the easiest way :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.