How to convert month name to number

How do I convert month name to number, from APR to 04?

With the rule engine node e.g.

I once had the same problem and wanted to have an automated approach. However, a Rule Engine with 12 Rules might be faster made :smiley:

Step 1: Convert the APR into “01.Apr.2018” (With the String Manipulation node as follows:

Step 2: Convert the String into a Date

Step 3: Use the Extract Date & Time Field node to get the month number.

My Mini Workflow looked like this:
image

4 Likes

Thank you Iris for your reply, this is very helpful.

2 Likes

Thanks, it is very helpful and works for me.

1 Like

I tried for several minutes to get this to work, and finally discovered that it only works if I pick a locale other than en-AU in the String to Date&Time node. Of course I haven’t tried all of the other locale options, but the several that I did try all worked, while it fails if I pick en-AU.

Is this a bug?

Hello @AngusVeitch1,

think it’s due to Java update (don’t think it’s a bug). See here:

Br,
Ivan

3 Likes

Thanks @ipazin. So yes, technically not a KNIME bug, but something that from the user’s perspective is wrong and inexplicable. Hopefully, the more expected behaviour will return in future with further Java updates.

1 Like