Java snippet get(Calendar.MONTH) does not return the correct month

One of the recent Tips & Tricks showed how to get the current Year/Month/Day using the Java Snippet node.  So I tried that. 

Today is May 29, 2012.   Here are my results:

return Calendar.getInstance().get(Calendar.YEAR);    returns 2012 as expected.

return Calendar.getInstance().get(Calendar.DATE);    returns 29 as expected.


return Calendar.getInstance().get(Calendar.MONTH);    returns 4, not 5.  Months do not start at zero.  This is just wrong and should be fixed.



This has nothing to do with KNIME itself and can't be fixed because your code uses pure Java functionality. I found this post in a Java forum that might bring some light into this mystery:

Thank you for the clarification and the link.  I didn't know that about Java, though it is an easy workaround.