Hi @jmancero,
I didn’t previously know fully what you were wanting to do. And had based my solutions on you saying said that the objective was to group sales by Store - category and month, and that you were trying to convert to yyyy-MM format so that you could use GroupBy. The above solutions would facilitate that.
Your mention of using the Date&Time based row filter, changes things. I hadn’t realised that you were actually expecting a real date.
OK, taking a step back then… A “date” will always consist of a year, a month and a day. You cannot have a date without a day (what specific date on the calendar would 2022-01, for example, represent?). This is why you are seeing the error message in the above config dialog. You are asking KNIME to store a date that it cannot understand, because you haven’t actually given it a date.
If you want your data in year-month format (e.g. 2012-02) , then that is always going to be a string.
Please note also that dates themselves have no format. It is quite a common misconception that dates have a format. In reality, they don’t. Internally they are just a number. Converting a string to a date does not give the date a specific format.
When displaying a date, the format used is whatever format the renderer chooses. For example, when KNIME displays a date, it may render it as 2022-06-01, but as mentioned, the internally held date itself does not have any format at all.
When you specify a date format in the String to Date&Time node, you are telling KNIME how it should interpret the string; not how the date should be formatted.
Likewise when you specify a date format in the Date&Time to String node, you are telling KNIME how to format the resultant string; not the date.
So, if you want a date in a specific format (other than KNIMES’ default rendering), it is always a string that you are formatting.
If you’re wanting to use a Date&Time Based Row Filter, then yes, I can see that you will need actual dates, but then you’ll have to go back to arbitrarily including 01 as the day, so that you can then convert your strings to real dates, like you mentioned doing before.
You will see that in the Date&Time Based Row Filter, you cannot simply choose “May 2022” to “Dec 2022”, because it wants actual dates. i.e. You always have to give it an actual date range (including the day), so I’m not sure exactly how you are intending to use that.
If you really only want to specify ranges using only year and month, then an alternative might be to make your dates into integers such as 202206 and then you can use regular Row Filter with numeric ranges e.g. 202205 to 202212. Not necessarily pretty but it would work.